[wp-hackers] plugins_url function

Otto otto at ottodestruct.com
Tue Dec 13 14:38:40 UTC 2011


On Tue, Dec 13, 2011 at 8:30 AM, Phillip Lord
<phillip.lord at newcastle.ac.uk> wrote:
>> Yeah the problem is that PHP resolves symlinks, so __FILE__ points to
>> the symlink target instead of the link file. I've written a plugin
>> which I use for my installs to correct it on a plugin-by-plugin basis.
>> Check it out here:
>>
>> http://lud.icro.us/wp-plugins/symlinked-plugins.phps
>>
>> You'll need to enter the filenames of your symlinked plugins into the
>> switch statement. You could probably swap it out for a nice system
>> that uses WordPress filters if you wanted to improve it.
>
> Okay, that's not ideal for me. In practice, I think it's easier to
> unwind the symlinks -- or just turn them around, so that the real
> directory is under wp-content/plugins then I symlink to this for ease.
>
> Glad it wasn't just me though:-)

Definitely a PHP issue, BTW.

https://bugs.php.net/bug.php?id=46260

Sometimes people have been able to workaround this by using
$_SERVER["SCRIPT_FILENAME"] instead of __FILE__.

-Otto


More information about the wp-hackers mailing list