Skip to:
Content
Pages
Categories
Search
Top
Bottom

changing WP_PLUGIN_URL to plugins_url()

  • Avatar of sboisvert
    sboisvert
    Participant

    @sboisvert

    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’;
    to:
    $dir = plugins_url( ‘images/wordpress.png’ , __FILE__ ). ‘/beakers/js/jquery.mentions’;

    If an SVN patch is useful I can provide that.

    Thanks,

    St├ęphane

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 http://core.trac.wordpress.org/ticket/16953

    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__.

    Avatar of sboisvert
    sboisvert
    Participant

    @sboisvert

    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.”

    http://codex.wordpress.org/Function_Reference/plugins_url

Viewing 2 replies - 1 through 2 (of 2 total)

The forum ‘BP Labs’ is closed to new topics and replies.