Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Looks like it’s not so much a permissions issue but more a mixture of url path and server path. Notice in the tooltip that it hits a “C:/Ampps…” path.

    Can you read over this, https://github.com/WebDevStudios/CMB2/wiki/Troubleshooting#cmb2-urls-issues, and the two GitHub issues referenced below it, to confirm if these are similar cases for yourself?

    Found this comment in the CMB2 source code, which I believe the link above refers to:

    * Defines the url which is used to load local resources.
     * This may need to be filtered for local Window installations.
     * If resources do not load, please check the wiki for details.
    Thread Starter Angelo Rocha

    (@angelorocha)

    Problem solved:

    function update_cmb2_meta_box_url( $url ) {
    	return get_template_directory_uri().'/lib/cmb2' ;
    } add_filter( 'cmb2_meta_box_url', 'update_cmb2_meta_box_url' );

    Is correct?
    Can go to production as well?

    Plugin Author Justin Sternberg

    (@jtsternberg)

    If you read the wiki section Michael linked to, you’ll see that it is far preferable to use str_replace vs overriding the URL directly. If you read that section, it will explain why.

    function update_cmb2_meta_box_url( $url ) {
        /*
         * If you use a symlink, the css/js urls may have an odd path stuck in the middle, like:
         * https://SITEURL/wp-content/plugins/Users/jt/Sites/CMB2/cmb2/js/cmb2.js?ver=X.X.X
         * Or something like that.
         *
         * INSTEAD of completely replacing the URL,
         * It is best to do a str_replace. This ensures you only change the url if it's
         * pointing to the broken resource. This ensures that if another version of CMB2
         * is loaded (i.e. in a 3rd part plugin), that their correct URL will load,
         * rather than forcing yours.
         */
    
        return str_replace( 'C:/Ampps/www/hypenews/wp-content/', 'wp-content/', $url );
    }
    add_filter( 'cmb2_meta_box_url', 'update_cmb2_meta_box_url' );
    Thread Starter Angelo Rocha

    (@angelorocha)

    Hi Justin, i read, but is complicated for me but my english is very bad, the problem is solved, thanks for your reply.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Problem with js and css – 403 Error’ is closed to new replies.