• Resolved David Gard

    (@duck_boy)


    Hey all,

    Just wondering if there is a standard variable in WordPress for ‘plugin_directory’ when writing a plugin, instead of having to declare it absolutly?

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • WP_PLUGIN_DIR ?

    Depends whether you want the path or the URL.

    As Rich said above for the path, for the URL try plugins_url(). You could use it like this to get your plugin’s folder.

    plugins_url( basename( dirname( __FILE__ ) ) );

    for the URL there is also: WP_PLUGIN_URL

    Ah, never realised there was a constant for the plugins url (had a full list of all constants infront of me and still never noticed that one – or maybe i wrongly assumed what it returned).

    Handy to know, thanks. ??

    Thread Starter David Gard

    (@duck_boy)

    Thanks guys, WP_PLUGIN_URL sorted me out.

    Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Is there a 'plugin_directory' variable?’ is closed to new replies.