Support » Plugin: WordPress Picture / Portfolio / Media Gallery » path2url() results in wrong path

  • Running Nimble Portfolio plugin v2.1.0 with site_url that is different from home_url.

    path2url() results in the most wrong path ever – doing string_replace on a string, based on the wrong assumption is quite bad.

    Please use the below code:

    function path2url($path) {
                if (!defined('ABSPATH')) {
                    return false;
                return plugin_dir_url($path) . basename($path);
                //return trim(site_url(), '/\\') . "/" . str_replace("\\", "/", trim(substr_replace($path, '', 0, strlen(ABSPATH)), '/'));

Viewing 1 replies (of 1 total)
  • Plugin Author Nimble3


    Well thanks for your insights on our plugin code 🙂

    path2url() is not dependent on whether the plugin is a standalone plugin or included in the theme, you don’t need a flag to check the location. We have tested it both on single and multi-site setups.

    We were using that plugins_url function before, but then it was only valid for standalone plugin install.

    I would really appreciate your time and interest in our plugin and I believe you or other community member can correct us if still thinks that we are making a mistake here.

Viewing 1 replies (of 1 total)
  • The topic ‘path2url() results in wrong path’ is closed to new replies.