Testing WordPress Code on Current & Pre-Release Versions Locally

TODO: Replace Generic Alt Text

I’m pretty sure many folks have ways of doing this, but this is how I test my work locally against current and beta/RC versions of WordPress:

[Note: I'm doing this on OS X. I'm pretty sure you can mimic this on Linux and maybe Windows with cygwin]

  1. I create a parent folder called “wordpress-dev”
  2. In there I put in both versions of WordPress, I name the current stable one “wordpress-stable”, the other “wordpress-beta”
  3. I edit my wp-config.php to grab settings based on the local url:
    $location = getenv('SERVER_NAME');
    include $location.'.php';
  4. In each file, I add all the domain & database settings that normally goes into the regular wp-config.php
  5. In the wordpress-beta folder, create a symlink to the wp-config.php file in the wordpress stable folder.
    ln -s /path/to/stable/wordpress/folder/wp-config.php wp-config.php
  6. Next, I symlink to my stable folder’s themes & plugins
    ln -s /path/to/stable/wordpress/folder/wp-content/themes/ wp-content/themes
    ln -s /path/to/stable/wordpress/folder/wp-content/plugins/ wp-content/plugin
  7. Now, I can browse to each local domain I’ve set up in Apache (and my /etc/hosts file) and voila! – I’m seeing what needs changing from my current production code to be compatible with the latest WordPress beta or RC release.

The added benefit here is that I can make my work future proof on the production code so that I can actually support the next version of WordPress by the time it reaches RC without breaking anything. I can update beta versions of WordPress easily by just overwriting everything except the wp-config.php file and the wp-content folder. I can also adapt much quicker to changing/added APIs and do so from one code base.

Have any tips to share on how you stay up-to-date with WordPress versions? How do you test current releases alongside pre-release versions? Feel free to share in the comments.

Cheers!

Back to Home