Skip to:

changing WP_PLUGIN_URL to plugins_url()

  • Good day,

    May I suggest changing the use of WP_PLUGIN_URL to the function plugins_url() ? this would make it easier to use the built in filters for things such as forcing HTTPS scripts.

    example, from:
    $dir = WP_PLUGIN_URL . ‘/bp-labs/beakers/js/jquery.mentions’;
    $dir = plugins_url( ‘images/wordpress.png’ , __FILE__ ). ‘/beakers/js/jquery.mentions’;

    If an SVN patch is useful I can provide that.



Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,

    What I dislike about plugins_url is that using __FILE__ like this doesn’t properly work when the file/directory is a symlink to another location (or when used on an IIS) server. See

    I use several symlinks to piece together my development environment, so I would not like to do that. I think my problem is with __FILE__ rather than plugins_url(), so I will investigate coming up with a helper function to replace __FILE__.

    I might be reading this wrong, but from what I understand you can hardcode the plugin slug in the first parameter instead of passing a second one.

    “The plugins_url template tag retrieves the url to the plugins directory or to a specific file within that directory. You can hardcode the plugin slug in $path or pass __FILE__ as a second argument to get the correct folder name.”

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘changing WP_PLUGIN_URL to plugins_url()’ is closed to new replies.
Skip to toolbar