WordPress Plugins and Symlinks

If you’re doing serious development for WordPress you will quickly find yourself in a situation where you need to test a plugin in multiple installations. Using symlinks is a great way to make sure that you don’t end up editing in multiple locations, perhaps forgetting to commit a change, etc.

However, there are some headaches with symlinks – particularly with common methods of including files:

include(dirname(__FILE__).'/my-include-file.php');

and related permissions issues if the files live outside the web root, etc.

Trying to figure out the symlink path to the file from within PHP is decidedly non-trivial, so a different approach may work best:

Here you can see we are maintaining the location of the file and path that WordPress used to include the file. This has worked well in my experience, perhaps it will be a good solution for you as well.

As always, improvements or suggestions are welcome.