• Resolved Ash Durham

    (@ashdurham)


    I haven’t had the chance to test this on a live server but I upgraded from 3.5 to 3.6 locally and all the plugins I have installed are now broken due to the plugins_url function adding the site url then the root url after it.

    1) is this only related to localhost versions and 2) is this I known 3.6 bug?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Ash Durham

    (@ashdurham)

    Surely i’m not the only one experiencing this?

    plugins_url('js/my-js-file.js', dirname(__FILE__)); or plugins_url('js/my-js-file.js', __FILE__);

    produces:

    https://localhost:8888/my/path/wp-content/plugins/my/local/path/wp-content/plugins/anyplugin/js/my-js-file.js

    Alternatively:

    plugins_url('js/my-js-file.js'); or plugins_url('js/my-js-file.js', 'anyplugin');

    produces:

    https://localhost:8888/my/path/wp-content/plugins/js/my-js-file.js

    This could be in the wrong area, but since this isn’t working locally, i’m not game enough to try this on a live server….

    Thread Starter Ash Durham

    (@ashdurham)

    OK, for anyone that cares, after doing some digging, it is a case-sensitive issue.

    WP_PLUGIN_DIR has folders in ‘camel’ case where dirname(__FILE__) has some of the folders lowercase.

    I have gone through my file structure and made all folders lowercase (outside folders from site structure that MAMP was using), reset MAMP servers and all is good.

    A fix that worked for me, rather than renaming everything lower case, was to add an i modifier to the reg expression in plugin_basename() as below:

    $file = preg_replace('#^' . preg_quote($plugin_dir, '#') . '/|^' . preg_quote($mu_plugin_dir, '#') . '/#i','',$file); // get relative path from plugins dir

    This line can be found in wp-includes/plugin.php on line 572.

    This worked with my install but I’m not sure what other implications it may have, so test before using!

    Thread Starter Ash Durham

    (@ashdurham)

    real-bassman,

    Glad to hear but I wouldn’t be suggesting changing core functionality in files, purely because the next update will override that change.

    I would really suggest a fix outside core files, the only one I could find was the renaming of the folders.

    Not sure if you found a way around this, but you might look at my solution at https://gist.github.com/aubreypwd/7828624

    Also, check out https://core.trac.www.ads-software.com/ticket/16953 on the status of this issue.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Plugins_url output erroring’ is closed to new replies.