As I find myself working more and more with WordPress I find myself needing to use it in different ways. I have been doing more work on other companies WordPress installs. This post will dive into converting an online WordPress install into and offline sandbox.
Why does making an offline version make sense? What happens when some developers develop their themes in undocumented ways, customize plug-ins by directly editing the files, or make changes to the base code of WordPress instead of using the functions.php file?
You might also want to do upgrade testing. Does your theme support automatic updates? If the update get’s applied does it effect the look of the website? Does it break it? Want to work early on that Christmas theme with posts from your website?
You might think all you would have to do is to copy the files to the new offline server, Export the MySQL data and then import. Unfortunately this normally doesn’t work due to WordPress hard coding several things in the database. You could also go through the database, edit it directly and so everything points to the write place and I have seen it work. Then again I have seen when people missed something and it either killed the blog right away or and upgrade later get botched and website turns into one big white screen of death.
The ideal way of doing it
The best way of creating an offline version is to make sure that you have downloaded the same version you are running on the website. If you can’t download the same version upgrade your online version first to the latest and greatest. Then install WordPress on the machine you want as the offline development server. For me it is my laptop because I take it around everywhere I go. on
Install the offline version of WordPress
I am assuming going to assume as few things from you:
- You have setup the hosting server
- You have copied the WordPress install files to the same server
- You have already setup a user/database for the WordPress blog in MySQL
- You have installed WordPress a few times before and don’t need a really in depth overview.
Go to the web folder where you installed WordPress. You should be walked through a wizard style setup. Click “Creat a configuration file”.
Click “Let’s go”.
Enter your information. Keep in mind even though your machine is offline you should take security into consideration. You Database and Username should NOT be the same. Your password should contain Upper/lowercase letters and a few numbers to mix things up.
You should get something like this if you entered everything correctly and setup the MySQL user properly.
Enter the blog info and then hit “Install WordPress”.
You will be shown a username and a temporary password. Make note of BOTH of them!
Log in with the user info:
Now is a good time as any if you want to reset the password that you were given at install.
You should make sure that it is easy to remember but it also should be a strong password.
Good work! You are half way there!
Exporting from the live WordPress
Go to the Live WordPress site and log in:
Go to the Tools menu on the left hand side and click on “Export”.
Make sure “All Authors” is selected then click “Download Export File”.
Click Save. I would recommend just save it to your desktop. It shouldn’t be that big of a file.
Going back to the “Offline” site click on “Import” from the Tools menu. Then click on “Wordpress” import.
Click on the Browse button and select the XML file that you saved to your desktop. Before click on the “Upload file and import” make sure that you have a good connection. I do recommend that you do the upload on a LAN line especially if the wireless signal you are using is weak.
Make sure just to tell WordPress to leave all the users alone which is the default setting for the users.
Make sure to check off “Downlaod and import file attachments and hit submits.
This will take a bunch of time if there was a lot of files. You will see each file listed on a line and numbered.
You’re now required to copy the theme folder from the Live server to the “Offline” server.
Any Plugins will needed to be downloaded and setup.
Leave a Reply