How to create a local copy of a live WordPress site

Blog

Posted on: September 16, 2020

You can actually copy a live WordPress site and get it running locally quite quickly. The benefits of a locally run WordPress site are understated. Running a website on your local machine means it's not connected to any live site, so it’s much faster to test plus it’s not going to overwrite any changes you’ve previously made. And perhaps the biggest benefit is that you can test new updates without worry of breaking a live site. Think of it like a playground where you can run free and do whatever you want with no consequences!

There are actually a lot of different ways to run a WordPress site locally, some easier than others. What I want to cover in this post is the medium ground. Something that’s going to get you set up for a more advanced configuration if you’d like to do so, but also easy enough that you can stick with the easy way of porting over the site if that’s more your style.

After configuring your computer to be able to run a WordPress environment, you can then install as many WordPress sites as you want. This is useful if you’re in charge of many WordPress sites and need to often test an update to a plugin quickly or similar.

Let’s get started!

Set up Your Computer to Run WordPress Locally

Whether you're on Mac or Windows, the same program exists to make it easy for you. You'll need to install and configure a program called Mamp. There is a pro version of this program, but you will only need the free version.

Install MAMP Head over here to download a copy of Mamp to install on your computer. After you’ve done so, go ahead and open the program. You’ll only need to click the “Start Servers” button to finish set up. Doing so should open the start page automatically, if it doesn’t, then open a browser and go to https://ineedafreakinwebsite.com and you should see the start page and Mamp information.

Next we're going to configure the website file system on your local computer.

Install a Fresh WordPress Site Locally

In order to get your WordPress site copied over, we’ll need to start fresh. Go ahead and go to the wordpress.org site and grab a fresh copy of the latest WordPress version. 

Extract the WordPress files, and copy them over to wherever you want your Websites hosted on your computer. Personally I like to keep a folder called “Websites” in my documents folder, then each site will have their own sub-folder, like this:

For this project, I’ll create a new folder called “test-wordpress-site”, and put the WordPress files there. 

Now in order to start the installation process, we’ll need to tell Mamp where our website files are. Here’s how to do that in each program:

In Mamp: In the menu bar, go to Mamp > Preferences > Web Server. Click “Select” next to “Document Root”, and select the folder you created above with the website files. Click OK, and the server should restart automatically. If not, click “Start Servers”.

Configuring WordPress install files in Mamp

Now when you go to your localhost, you should see the WordPress setup screen. Before we get started with that, we’ll need to create a new database. I know this sounds daunting, but it’s very easy!

Create a New Database with PhpMyAdmin

So we have the WordPress installation files set up, now we are going to need to get a database for WordPress to work from. Note that you’ll need to do this every time you create a new local WordPress site, each site needs it’s own database. 

To start, access PhpmyAdmin by going to https://ineedafreakinwebsite.com/phpmyadmin. This will be where you can control settings and edit your local databases. 

PhpMyAdmin databases on localhost

To create a new one, go to the sidebar, and click “New”. This will give you a field to create a name for the database, enter something like “test-wordpress-site” (make sure your name does not contain spaces) and click “create”. 

Creating a new database in PhpMyAdmin

Database: Check! That’s all the hard stuff! Now we just get to play with WordPress. 

Create a Copy of the Live Site

In order to get a local version of your live site working, you’ll need to grab a copy of the live site. 

There is a way to export the database, export the files via FTP, and then import those into your local machine, but that can be a bit hard for beginners and potentially more time consuming. So what we’re going to do is use an amazing plugin called WP All Import. I hate using too many plugins, but this one really makes it worth it for how easy it makes this process. 

So go to your live site, install WP All Import, and then go to WP All Import > Export. Download a copy of the site and remember where you’re storing it. 

Export a copy of your entire WordPress site

Now you have an entire copy of your site located in one copy. Pretty neat huh?

Set Up WordPress Locally

Now lets hop back to our local version of WordPress by going to https://ineedafreakinwebsite.com. This should take you to the default WordPress start/install screen. Go through the steps and fill in some basic info. Since we are going to be overwriting the site title, etc, it doesn’t really matter what you put there. 

When you get to the database step, input the name of the database you created previously, then put “root” for both username and password. Database Host and Table Prefix and remain the same with no changes.

Setting up WordPress database on localhost

Then click install, and it will magically create your WordPress site!

Clone the Copy to your Local Site

Congrats! You have a working, local copy of WordPress! You can use this now just how you would use a normal WordPress site, only…well it won’t be on the public internet!

Let’s get your live site copied over. Install the WP All Import plugin, then go to WP All Import > Import. Select the file you downloaded previously, and then start.

Cloning a WordPress site to Localhost

It will take a little bit, and when it prompts you to overwrite the database go ahead and say yes. 

Using WP All Import to import database to local computer

Once it’s finished, you should have a working local copy of your live site. This will be completely separate from the live version, and you are free to do with it what you wish!

The nice thing about having a WordPress site installed locally with WP All Import is that you can just overwrite your site as you go. So if you have a different site you want to test local, you dont need to create a new local site, just export and import into the same WordPress site. Just remember that it will overwrite your previous local WordPress site.