WordPress Development: Development Copy
Posted on October 26th, 2009
When you’re running WordPress in a production environment, it is ill-advised to make changes without testing. The best way of doing this is to run a secondary copy of your blog that you can test changes on first, before pushing them out to your production blog. These changes may include new plugins, plugin development, a new theme or even WordPress upgrades.
To duplicate your WordPress production environment, you’ll need to do a couple of things. First, you’ll need to decide whether you want to run your testing site on your own computer, or on the same server as your production site. Running your testing site on your computer will have the advantage of allowing faster development; however, you will not be able to perfectly replicate your production environment. By having your test site on the same server as your production site, you’ll obviously benefit from having the same environment.
Once you have decided on that, you will need to create a copy of the files you use on your current WordPress install (including your theme, plugins, etc). Simply downloading/copying these files via FTP will suffice. If you will need to sync files back and forth quite often, you should look into more complicated solutions.
For the database side of WordPress, we’ll be using a copy of our production database. This will give us a full set of data to play with on our development site. You can use phpMyAdmin to export your production database and import it into your development database. You’ll need to adjust the database setting in your development wp-config.php accordingly.
If you’ve been following along, you’ll have noticed that your development blog redirects to your production blog. WordPress stores your site’s URL in its database, and will redirect to it when the current URL doesn’t match the one stored in your database. Instead of modifying our development database accordingly, we can override the URL in our development wp-config.php. To do this, you’ll need to add the following two lines to your development wp-config.php:
[php]define(‘WP_SITEURL’, ‘http://example.com’);
define(‘WP_HOME’, ‘http://example.com’);[/php]
WP_SITEURL is the URL location of the WordPress files. WP_HOME is the URL to get to the blog portion of your WordPress site (this will differ from WP_SITEURL if you have a static front page). Omit the trailing slash from the url.
You should now have a functioning development copy of your blog to play with. Be careful about syncing changes back to your production plan and always backup your data beforehand.
Posted in Development | | | Digg This | del.icio.us | Technorati
Related Topics:
WordPress Developing: Following Development
WordPress Development: WordPress 2.9 Beta 1
WordPress Development: IRC Development Chats
WordPress Development: Plugin Suggestions
WordPress Development: Plugin Directory Structure
Comments
Sorry, the comment form is closed at this time.
No comments yet.