[wp-hackers] plugin_dir_url() and symlinked plugins

John Blackbourn johnbillion+wp at gmail.com
Tue May 17 14:48:48 UTC 2011


I use this code in my plugins to determine the URL of the directory
that the plugin lives in:

plugin_dir_url( __FILE__ );

This works fine unless the plugin's directory is symlinked from
another location, in which case it returns a broken URL with the path
to the symlink target appended [1].

Does anyone know of a method of determining a plugin's URL that
supports symlinks?

John

[1] Test plugin at http://pastebin.com/xYyfWtcH


More information about the wp-hackers mailing list