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.
Alex King: WordPress Plugins and Symlinks: If you’re doing serious development for WordPress you will quickly fi… http://t.co/heL9lTOX
WordPress Plugins and Symlinks: If you’re doing serious development for WordPress you will … http://t.co/nrQYKMWO #wordpress #wp #news
[…] Home > Home > Links > Alex King on WordPress plugins and symlinks PermalinkAlex King on WordPress plugins and symlinksBy Ryan Imel 1 min agoDecember 16, 20110 var addthis_product='wpp-262';var […]
WordPress Plugins and Symlinks from @alexkingorg: http://t.co/PG0SIPvp
#WordPress Plugins and Symlinks http://t.co/kAuc7oFV
[…] Plugins and Symlinks : alexking.orgWordPress Plugins and Symlinks : alexking.org. VN:F [1.9.12_1141]Rating: 0 (from 0 votes)Related […]
WordPress Plugins and Symlinks http://t.co/fVeAi0a8
WordPress Plugins and Symlinks : http://t.co/E1wWcMAA http://t.co/fe1i4HD2
Can you explain the $plugin, $mu_plugin, and $network_plugin variables? Where/how are these set?
I could, but you’ll learn more if you dig into the code… 😉
Oh! I found them in wp-settings.php before, but dismissed them because of the unset() call. After looking at the code a second I realized my stupid mistake. Thanks!
In 13 lines of code you solved what I’ve been bashing my head for at least 13 minutes trying to solve!