[wp-hackers] plugins_url function

Mario Peshev mario at peshev.net
Thu Dec 15 09:13:01 UTC 2011

I use them normally, just encountered the constant in a code snipped of a
client of mine and looking for the right explanation why using the func is
better (ssl support and future extensibility is fair enough)

powered by Android

On Dec 14, 2011 8:58 PM, "Jeremy Clarke" <jer at simianuprising.com> wrote:

I hit this issue as well. The best solution I've found is to use some code
similar to what John B posted that filters plugins_url and targets the
specific predicable results of __FILE__ on the given system.

One optimization I'd add is to use the mu-plugins folder rather than normal
/plugins/. This way the plugin is always active on that site without having
any references to it in the database (so that when you copy the db to your
local dev site the plugin isn't missing). It also just makes sense to have
it there, as it's party of the 'hard' setup of the site rather than the
'soft' config.

My code is actually a lot simpler. Not sure if there's a case I'm not
accounting for, or if I'm just depending more on plugins_url() to take care
of SSL stuff for me, but feel free to contrast and compare with John B's


On Wed, Dec 14, 2011 at 10:23 AM, Mario Peshev <mario at peshev.net> wrote:

> Is WP_PLUGIN_URL an acc...
WP_PLUGIN_URL, along with the other constants, are effectively deprecated.
You should never use them, instead always use the functions like
site_url(). The constants do not currently have any kind of is_ssl()
support so you are just asking for problems. The functions also work better
so why not use them?

Jeremy Clarke • jeremyclarke.org
Code & Design • globalvoicesonline.org

wp-hackers mailing list
wp-hackers at lists.automattic....

More information about the wp-hackers mailing list