Junction/Simlink Causes plugin_url() to Return the Wrong URL

I’m testing my plugin in various WordPress versions and using symbolic links for it. I use the tool called Junction for Windows. This way I just only need to edit the trunk files. However, WordPress does not seem to handle symbolic links very well.

For example, if I run a plugin with the following code.

Read More
<?php
/*
    Plugin Name: Junction/Simlink Test
*/
echo __FILE__ . '<br />';
echo plugins_url('junctiontest.php', __FILE__) . '<br />';
?>

and create a symbolic link, (this is for Windows)

junction “z:xampphtdocswp34wp-contentpluginjunctiontest2” “Z:xampphtdocswpcurrentwp-contentpluginsjunctiontest”

when I open the admin page of the test site with the url of wpcurrent, I get

Z:xampphtdocswpcurrentwp-contentpluginsjunctiontestjunctiontest.php
http://localhost/wpcurrent/wp-content/plugins/junctiontest/junctiontest.php

However, when I open the admin page of the test site with the url of wp34, I get

Z:xampphtdocswpcurrentwp-contentpluginsjunctiontestjunctiontest.php
http://localhost/wp34/wp-content/plugins/Z:/xampp/htdocs/wpcurrent/wp-content/plugins/junctiontest/junctiontest.php

This breaks the linked plugin.

So any suggestion to avoid this? I do not like to copy and paste the plugin into each directory every time I make a change in the trunk files.

I found this page: http://core.trac.wordpress.org/ticket/16953 It seems this is a known issue held by many plugin developers and it hasn’t been solved.

Related posts

Leave a Reply

1 comment