[wp-hackers] plugins_url function

Phillip Lord phillip.lord at newcastle.ac.uk
Tue Dec 13 11:40:19 UTC 2011



I'm using the plugins_url function to insert links to my javascript for
my kcite plugin (http://wordpress.org/extend/plugins/kcite/). In
general, all seemed to be working well till I tried to install it on my
own blog. In general, I have wordpress set up as you might expect

wordpress/wp-content/plugins/kcite

However, on my own blog I use a structure like so...


wordpress/wp-content/plugins/kcite symlink'd to

~/wordpress-plugins/kcite

This fails rather badly as this call

plugins_url( "kcite-citeproc/kcite.js",__FILE__  )

which should be interpreted as 

http://server/wp-content/plugins/kcite/kcite-citeproc/kcite.js

is actually interpreted as

http://server/wp-content/plugins/home/myusername/wordpress-plugins/kcite/kcite-citeproc/kcite.js

That is, the symlink is unwound. Obviously, this isn't ideal, if for no
other reason that it exposes myusername to the world. The correct URL

http://server/wp-content/plugins/kcite/kcite-citeproc/kcite.js

does actually resolve fine. 

Am I missing something? I can replace the whole thing with

plugins_url( "kcite/kcite-citeproc/kcite.js" )

which does seem to work, but will fail for some configurations. So, I'd
like a more ideal solution.


Phil




More information about the wp-hackers mailing list