Local Copy of WordPress Site Won’t Work

It only makes sense that creating a local version of a live WordPress site should be the opposite of launching a live WordPress site from a local dev version. However, I always run into bugs that make me wary of taking on complicated long-running WordPress sites because I don’t know how I will test my changes before I get them up and running.

I have found a solution!

How to make a local version of a live WordPress site

The main problem is that database replacement tools like Search and Replace¬†won’t work on a local host. So here is how we get around it.

  • 1. Move the wp-content from your live site into a new WordPress install.

    Once you have downloaded the files from the live site, change directions and head over to wordpress.org and download a fresh install of WordPress. Unzip it, rename it to reflect the project you are working on and move it to your folder that is set up with your local server.

    Then copy the wp-content folder from your live site and insert it into the new install. Remove the old wp-content folder and make sure the new one is titled “wp-content”. Also copy the wp-config file and change the user name and password to root. You may also need to change the database name though I like to name the local database after the live database for consistency. Change the host to localhost if it is not already.

  • 2. Link the Database to the new install

    Instead of changing all instances of http://example.com with a Search and Replace tool, manually change the Site URL and the Home entry in the database. Go into your database and choose the wp_options table and the browse tab. The first and second entry are usually siteURL and home. Click and change the entries from the live address http://www.example.com to your localhost address and file path something like http://localhost:8888/example

  • 3. Check it out and Refresh the Permalinks

    In your browser, navigate to http://localhost:8888/example and you should see your site! Then go to http://localhost:8888/example/wp-admin and WordPress will say that it needs to update the database. Click yes and eventually you will be taken to the lovely Login screen. Enter your username and password from the live site and bingo bango! You are in.

    Then a quick visit to SETTINGS > PERMALINKS. Don’t change any settings just scroll down the bottom and click SAVE. Then check out your site! You should be good to go! Now you can make all the mistakes you need to without angering the internet gods and your clients.

Good luck!