How to Clone WordPress Site and Install WordPress on Localhost

Clone WordPress site and you will be on the safe side

You can do whatever you want without impacting your WordPress

When I first started writing this post

My plan was to create a single post as it is one task at the end

But I soon realized that I am having around 70 images which I created for illustration purposes without writing any single word

There are few affiliate links, if you click a link and make a purchase, I may receive a commission at no extra cost to you

Imagine waking up one day and logging on to your WordPress website for writing a new post

Then you find a new WordPress updates, plugins or themes updates

You click on the update button and all of the sudden you get everything messed up

This issue happened to me so many times

So I decided to create this post to cover how to clone WordPress site safely

I will do my best here to make it as easy as possible

At the end of this post, you will able to clone your WordPress site without any hassle

Before you clone your WordPress site

I am going to provide you with step by step free guide on how to update WordPress safely but with the following assumptions

1- I am showing you here how to do everything for free

But I highly recommend to at least invest in buying any of the below

UpdraftPlus, Duplicator or DesktopServer as the premium version of any one of these really helps a lot in saving your time by automating the processes

2- I am not showing you here how to test your local copy of your cloned WordPress site

I assume here you have enough knowledge on how to verify that

For example all plugins' functionalities are working fine

Widgets are all in place and your current theme is OK

3- I am assuming that you are testing your cloned WordPress copy on your local PC on all browsers

Don't blame me for browsers incompatibilities

This happened before to have your WordPress layout inconsistent between different browsers

You will not notice this as you are testing on one single browser and not on all the others

4- I am assuming that even testing all browsers successfully will not help you to detect any issues on mobile devices (assuming your are using responsive theme design)

You will not be able to test on mobile devices as your are hosting a local copy of your cloned WordPress site on PC

Again don't blame me on that

Hint: if you really want to cover this area of testing

Then you can invest in another domain name for testing and have all your testing carried on your web hosting

Remember to remove your testing WordPress website from Google indexing

If you agree with all the above assumptions then let us move on

Introduction to WordPress updates

WordPress usually gets a new release every 120 days which means 4 times a year

If they are planning to make an exception then they will announce it

This is due to the fact that most WordPress developers are volunteers

Few of them are getting paid by Automattic (the company behind WordPress.com)

They work continuously to improve the WordPress and to bring to you new features

But why we have to update our WordPress sites

Well there are 3 reasons to consider

  • Security: When new WordPress version comes, older versions are no longer supported and are susceptible to malicious attacks
  • New features: WordPress team is always working on adding new features and usually they come in major releases (I will discuss it below)
  • Plugins and themes: Most of WordPress plugins and themes are developed by developers in WordPress community so they have to update their code to comply with the new WordPress releases

Minor release vs Major release

Minor release (as knows as point release) always increments the number version by one decimal or two e.g. from 3.0 to 3.0.1

You don't need to worry about this release

Most probably WordPress released it to fix a minor bug or to clean up a source code.

Major release jumps a whole number when adding new features

e.g. from 2.9.2 to 3.0

This is a sign of new features added to the release

That is what you need to properly test to make sure you can proceed with the new major WordPress updates

Upload your backup to Google drive using UpDraftPlus plugin

Assuming you know how to install plugins on your WordPress site

Go ahead and install UpdraftPlus plugin then go to Settings on your left hand side menu

Select UpdraftPlus Backups, under the UpdraftPlus Backup/Restore page on the first line with tiny font you will see a hyperlink notice that says

UpdraftPlus notice: Follow this link to authorize access to your Google Drive account (you will not be able to backup to Google Drive without it)
clone WordPress site - step 1 UpdraftPlus authenticate google drive

Log on to your Google account

I suggest to create a new account with your site name

This will give you 15 GB under Google drive to help you clone your WordPress site

clone WordPress site - step 2 UpdraftPlus logon to google drive

After you create your Google account (or use your existing account if you would like)

UpdraftPlus plugin will ask you to allow the installed plugins to access your Google account

Click on Allow button as shown below

clone WordPress site - step 3 UpdraftPlus allow access to google drive

A confirmation screen will be displayed indicating that Google authorization is in place

Click now on the Complete setup button as shown below

clone WordPress site - step-4-UpdraftPlus-authentication-completed-on-google-drive

Now you can click on the blue Backup Now button

clone WordPress site - step-5-start-package-on-duplicator-plugin

All these checkboxes listed below are checked for you by default

Don't change anything, just click on Backup Now button

clone WordPress site - step 6 UpdraftPlus backup now on google drive

A progress bar will show up indicating the percentage of completion

Just wait for a while

clone WordPress site - step-7-UpdraftPlus-backup-progress

Now switch to your Google Drive account to verify that all the 5 files are completed backup successfully

clone WordPress site - step-8-UpdraftPlus-validate-backup-on-google-drive

Creating your WordPress backup using Duplicator plugin

Search for duplicator plugin

It should be the first one to show up on search results

Click on Install Now button as shown below

clone WordPress site - step-1-install-duplicator-plugin

Then click on Activate button, it will take you to the Plugins screen

clone WordPress site step 2 activate duplicator plugin

On the plugins screen, under Duplicator click on Manage button

clone WordPress site - step 3 click manage on duplicator plugin

Duplicator will show up the Packages screen with No Packages Found message in the middle of the screen, click on Create New button

WordPress step 4 create new package on duplicator plugin

Duplicator plugin will create the backup name as today's date followed by underscore and your website name

This is the backup to use to clone your WordPress site

On the first package you will create you want to make sure not to check Archive Only the Database option under Archive folder shown below

As you want to backup files and database

On the next backup you can select this option assuming you did not update your WordPress (no new plugins or images uploaded)

clone WordPress site - step-5-start-package-on-duplicator-plugin
clone WordPress site - step-6-scan-package-on-duplicator-plugin

On the scan screen, you just sit and wait, no action from your end

After you see the scan completed, click on the blue Build button

clone WordPress site - step 7 build package on duplicator plugin

Building your package will start, again no action from your end

clone WordPress site - step 8 finalize package on duplicator plugin

After your see the package completed

You should download 2 files

First file is called Installer (full filename is Installer.php) and the second file is a zip file which contains all the WordPress folder from your web hosting account

You can also click on the One Click Download hyperlink

But remember you have to first select Always allow pop-ups and redirects from your website as shown below

You have to click on the little icon with red dot on upper right corner

Finally make sure to save your files under a known location as you will use it later

clone WordPress site - step-9-download-package-from-duplicator-plugin

Downloading and setting up DesktopServer

Now it is time to download an application on your PC or laptop called DesktopServer

This tool will help you build your cloned WordPress site

Just go to ServerPress website

This application will let you run WordPress on your local PC without internet connection

It comes as Premium version and a free one, I will use the free version here

Downloading free version of Desktop server

ServerPress step 1 download free version
ServerPress step 2 proceed to free version
ServerPress step 3 checkout free version
ServerPress step 4 extracting dsl win v391

Scroll down all the way to end of page and click on Free – Add to Cart button

This will take you to the checkout page as shown below

Type your information as all fields marked with asterisks are mandatory

Check the Agree to Terms checkbox and click on the Free Download

This will download a file called dsl-win-v391 as of writing this post (new versions may be released later)

ServerPress step 5 running snstall dsl v391
ServerPress step 6 continue to install

Double click on the Install DSL v391 to start the installation process

Click on Continue button to proceed

You may get a message like the one I got during my installation

It says something like port 80 is being used by another application or service

Anyway I opened Services

I suspected that World Wide Web Publishing Service was causing this issue and I was right

ServerPress step 7 stopping world wide web publishing service
ServerPress step 8 running desktopserver first time
ServerPress step 9 extract database archive
ServerPress step 10 copy database archive folder to xampplite ds plugins

Other solution is to download cPorts application from ServerPress itself as a zip file

Extract it to a folder and run cPorts.exe

This helps detect Port 80 used by which application

After installation of DesktopServer gets completed

It creates a folder called C:\xampplite

Go to this folder to make sure you have files there

I recommend to create an icon for DesktopServer application on your desktop.

Also I downloaded an add-on from ServerPress called Database-Archive

It creates files which contains all your databases and their configuration

In case you want to run it on multiple PCs or to restore it later in case of PC crash

When you extract the files, copy the inner folder which is called database-archive as it comes with MAC (_MACOSX) and Windows versions and paste it under C:\xampplite\ds-plugins

Remember to make sure that the database-archive folder which you are going to copy does not contain sub-folders but only the required files only

ServerPress step 11 click on desktopserver

Setting up DesktopServer

Now run the DesktopServer exe from inside C:\xampplite or from your Desktop icon.

DesktopServer starts with 2 options

By default Yes, Start Apache and MySQL services is selected by default

Notice that the Database Archive is there

This is the one which we copied earlier to C:\xamppliteds-plugins.

clone WordPress site - ServerPress step 12 select database archive
clone WordPress site - ServerPress step 13 start web service done
ServerPress step 14 create new development website

Next step, it will notify you that Start web and database services are completed

Click Next button as shown below

By default, the create a new development website is selected, click Next

It will ask you for the site name

I always recommend to create the exact domain name without the extension as shown below

Note: Blueprint is a drop down list which contains WordPress versions

you can download latest version and add it to Blueprint drop down list if you want to (DesktopServer has WordPress-4.9.6 at the time of writing this post, while WordPress was on 4.9.8 version

ServerPress step 15 type your sitename
ServerPress step 16 preparing your website
ServerPress step 17 website configuration completed

Anyway to update the Blueprint, download your WordPress version (whatever, it can be before 4.9.6)

Copy the zip folder to C:\xampplite blueprint, in this case you have to close DesktopServer and start it again to refresh the Blueprint drop down list

When you click Create button as shown above, you will notice a list of steps taken to prepare your local copy of WordPress site then the word Done! right below

click Next button as shown below.

After installation gets completed, you will see a URL as shown below

I always ignore it as I don't want to setup my WordPress from scratch

I just want to copy my existing WordPress site to my local.

For now to verify that everything is in place

Open any web browser and type localhost in the URL

You should see the page loads something similar to the screen below

ServerPress step 18 testing localhost

Clone an exact copy of your WordPress site to your local PC

Now before I start

I will delete all the files installed under my local WordPress site which was created by Desktopserver

Why I am doing this, simply because the Duplicator plugin created a complete package of my WordPress website

It contains all the files required to get a cloned copy of my hosted WordPress

I don't really care about the new blank WordPress site

Running duplicator

First, I will start by getting the local path of my new blank WordPress site

I searched under C:\Users\my_profile\Documents\Website\name_of_website.dev.cc

Where my_profile is the name of the Windows' user

In Mac OS I think it is under Documents folder

Then I will delete all files under name_of_website.dev.cc

I will copy the Installer.php and the zip file which I downloaded earlier from Duplicator plugin to my local WordPress site folder.

Now open any web browser and type the following URL name_of_website.dev.cc/Installer.php in my case

I went to DoYourBlogWithMe.dev.cc/Installer.php and press Enter (Return in Mac)

Duplicator step 1a Deployment top page

The screen above and below is one long screen listing all the prerequisites

Before you start the cloning process

Click Next button as shown below

Duplicator step 1b Deployment bottom page

Starting duplicator for your clone WordPress site

Duplicator will start running the deployment process and it extracts the zip file into the local copy of your WordPress folder.

Duplicator step 1c deployment screen running

After extraction gets completed, Duplicator will display the local copy of database

It is not created yet as Duplicator is not responsible for creating databases

It has to exist to it can copy only your web hosted WordPress database to the local MySQL database.

Duplicator step 2a deployment install database

In order to create a local copy of MySQL database

Open any web browser and type localhost

It will load all the current DesktopServer websites

Remember you are only allowed 3 websites with the Free copy of DesktopServer

Configuring your WordPress database using duplicator

Click on Database button

Duplicator step 2b run phmyadmin to create new database for migration

This will load a local copy of phpMyAdmin with Username = root and password is blank, click Go button.

Duplicator step 2c login to phmyadmin

Now phpMyAdmin starts with all local databases

I suggest to use the existing one which was created earlier by DesktopServer

Select this database on the left by just clicking on it, click on Privileges menu as shown below then click on Add user account.

Duplicator step 2d add new user under phmyadmin

Type the new user name and select all privileges and then hit Go as shown below.

Duplicator step 2d give all privileges to new user under phmyadmin

Now click on operations to rename database to something easy to remember and click on Go.

Duplicator step 2e rename database optional under phmyadmin


Now I will switch back to the Duplicator screen and type the database name, username and password then click on Test Database button

I can click on Yes button to start the update data process

Duplicator step 2f db username password into duplicator

Duplicator on this step it will display the URL, Path and Title (I believe Title was picked up from Duplicator original database)

Click on Next button as shown below.

Duplicator step 3a update data confirmation screen

Duplicator will start updating the database by copying all records to the local MySQL database which I specified on the steps above.

Duplicator step 3b update data progress screen

Duplicator completes with a screen showing Site Login or Show Report

Click on Site Login button as shown below

Duplicator step 4a completion of database migration

Congratulations, you now have a cloned copy of your web hosted WordPress site for you to test and play around

Duplicator step 4b local copy of wordpress

Installing the new WordPress core, plugins and themes updates on your local PC

Now you are running your WordPress site on your local but how can you update your local copy of WordPress with plugins, themes and cores (updates to WordPress itself)

First, you need to know that all plugins, themes and cores exist as a zip file although you install them from inside WordPress dashboard

But you can still get a copy of the zip file and download it on your local PC

For plugins, click on More Details link under the plugin (Image 1)

As it will load the plugin details with the location of the file on WordPress.org (Image 2)

And you will be able to click on Download button (Image 3)

WordPress-download-plugin-zip-file

For themes, go to Appearance menu and click on themes

On the Themes page click on button

This will load the Add Themes screen,

Take a note of the theme name which you want to download

Then go to WordPress.org and type the theme name in the search section on top of the screen

This will display the link to this particular theme,

Click on the link (in my scenario, Viable Blog) and it will load the Viable blog theme page on WordPress.org with the Download button to the right.

WordPress-download-theme-zip-file

For WordPress cores, go to https://wordpress.org/news/category/releases/ to find your WordPress release

Testing and applying the new WordPress core, plugins and themes updates on your WordPress site

This topic can be a separate post by itself

I am planning to do that but for now I want you to pick my brain on this

I will display below a simple concept which you can take it from there and work on that

But If you are testing for minor releases then don't put much effort.

clone WordPress site Test Plan

Now for major releases, create an excel sheet as shown below with row A2 going all the way down to row An as list of items to test

You can add to this list going forward when new things pops up and column B to column n as list of different browsers.

Finally I know I showed you how to clone WordPress site

Please share it using social media to the left hand side or bottom (mobile)