If you have a WordPress site, you may have imagined how useful it would be to have a development version of your site running on your hard drive, that you could experiment a
nd play with offline without having to modify your actual site.This post will describe one of the simplest ways that you could get a version of your site up and running on your hard drive easily and in record time, without needing to have too much technical expertise and without having to play with or modify actual code or .htaccess files, create databases and/or users, etc. You don’t even have to have FTP access to your live site, necessarily.
Note, however, that you will not have a 1:1 clone of your website running locally but rather a version of it that will look the same (the distinction is important if you are interested in, say, debugging your WordPress site, in which case this tutorial is not what you need).
Tools used in this tutorial:
- DesktopServer Server Limited(the free version; which will contain everything that you will need to run a WordPress site, and is based on Xampplite).
- Two WordPress plugins: WordPress Importer and Search and Replace plugin (do not download these just yet, wait until prompted in the tutorial below).
Yes, just these tools. Seriously. (Although FTP client,might be useful to pre-download your media files locally, as discussed in step 5.5).
Here’s a summary of the steps:
- Download the ‘export’ file from your live site
- Download and run the free version of DesktopServer
- Configure DesktopServer
- Setting up and updating WordPress
- Importing your XML export file
- Find all online references and replace them with Local URLS
- Housekeeping: fix site settings, menus, and install the theme(s) and plugins that you need
- How to launch the local site
2.1 Download the free version of DestkopServer here. Scroll down the page to the DesktopServer Limited (free) section. Click on the ‘New Install’ links for Mac or Windows. This tutorial will be based on the Windows version, and will assume you are working with Windows, but you could easily adapt it to Mac.
2.2 Unzip the archive anywhere you like, then click into the extracted folder. Inside you will find a folder named ‘xampplite’ and a readme file.
2.3 Move the ‘xampplite’ folder from step 1 above to your root (C:\) drive. It has to be placed in that location; in the root and NOT in any subfolder such as ‘C:\Program Files\’ etc.
2.4 Open the ‘C:\xampplite’ folder and run ‘DesktopServer.exe’
When you run DesktopServer.exe you should see the screen(s) below. Note: if you get an initial screen asking to rerun DesktopServer with Admin privileges, let it do so.
|5.1 Go to tools / import|
|5.2 Select ‘Wordpress’|
|5.3 Next, WordPress will attempt to install the import plugin. Your system need to be online for this to happen. Click ‘install now’.Once import plugin is installed, click on “Activate and run Importer” as shown to the right.|
|5.4 Import your WordPress XML export file from step 1.2 above.Click ‘Choose file’, browse to the XML export file downloaded on your hard drive, then press ‘Upload File and Import’.|
|5.5 Important decision to make regarding downloading your media files”If your live site has a huge amount of media files (say 500 megs of media files or higher), it might be better to download your media from the server and place it in the uploads folders manually, before importing. The default path of the upload folder would be: “My Documents\Websites\www.yoursite.dev\wp- content\uploads” by default. (Note that yousite= the name you are using for your site).Otherwise, if you have too many files to download, the importing process might fail or have to be restarted several times.Note: if you go this route, you can use WinSCP, a free FTP client which has a folder synchronization option. You will need info about your FTP server and a login and password to connect. Either way, whether you choose to download via FTP or not, continue on to step 5.6|
|5.6 Import with Attachments. The WordPress importer will now display a screen, such as the screenshot on the right, with names of authors. You need to do two thingsOne: scroll down to the bottom.Leave all authors as is.Two: check the box that reads “Download and import file attachments” and click ‘submit’. WordPress will now start working. It will likely take a long time.|
|5.7 Troubleshooting the ‘Import’ processThis step may take a long time, because this is where your media library will be downloaded to your hard drive. You should consider that your media files on the live site may amount to hundreds of megabytes, all of which need to be downloaded (which you can go around if you pre-download via FTP as discussed in step 5.5). A few things to consider hereOne: if you see an interminable blank screen, or if your browser seems frozen or stops working, , you can relaunch the import process (remember to check the ‘import attachments’ box when you do so). Do not worry; any users that were previously created or media files previously downloaded will be there and will be skipped, so there’s no duplication of effort or downloads.Two: if you have a really large site, you may need to relaunch the import process a handful of times. My advice is to wait for it to finish.Three:if you see error messages such as ‘failed to import media’ or trim() expects parameter etc., do not worry about it; let it finish.Four: if you encounter any glitches, you can re-launch the import process as many times as you need to until it is done. Remember to check the “Download and import file attachments” box every time, though.|
|5.7 Preview your siteGo to yoursite.dev; you should see your site, with the last published post on top. It will be using the WordPress default theme (‘Tweny Eleven’); because at this point you have not added your desired theme to the local install. If you are online you will see images, but note that they are still linked to the live site, which we will remedy below.If you do not see the post you expected appear as the first entry, go back to step 5.6 and import yet again. Also consider importing your media via FTP as per step 5.5.|
To do this, we will use the ‘Search and Replace’ plugin.
Step 7: Housekeeping: fix site settings, menus, widgets, and install the theme(s) and plugins that you need.
Your site should be completely functional by now. However, there are a few more things you need to do.
- Check the settings: general, reading, writing, discussion, media, and (imporantly) Permalinks. Make sure that the setting are the same as your live site.
- Recreate menus: go to Appearance, menus, and make sure to recreate the menus in the live site, if you want these
- Recreate widgets: go to Appearance, widgets, and make sure to recreate the widgets in the live site, if you want these
- Install and activate the desired plugins
- Install and activate the desired theme (or themes, if you want to test out more than one, etc).