Support » Plugin: Cookies and Content Security Policy » Error message with php-js-file

  • Resolved Viktor Bijlenga



    I’ve noticed an error message on an WordPress install which is using custom paths for the location of WordPress core. In this case the site is using the composer template project Bedrock by Roots.

    The error is a 500 internal server error while requesting the following file:


    I think the reason behind the fault is line 4 in the file, but it just a guess.
    require_once( explode( "wp-content", __FILE__)[0] . "wp-load.php" );

    In Bedrock wp-load is located on another location:

    This seems to be a common issue when using WordPress with custom paths, since it’s noted in Bedrocks documentation about compability.

    Would it be possible to create a bugfix for this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Johan Jonk Stenström


    Hi! I’m currently working on a solution. If you want to beta test it, drop me a line to

    Thread Starter Viktor Bijlenga


    Follow up: This issue is solved with the release of version 1.94 and above of the plugin. Thanks for your work @jonkastonka!

    Custom path for Bedrock:
    Add cookies-and-content-security-policy-vars.php to the plugins folder and use the following settings for wp_load_path.

    $wp_load_path = dirname( __FILE__ ) . '/../../wp/wp-load.php';

    Sidenote: I propose that the solution of this issue is refactored in favor of using wp_localize_script() sometime in the future.
    Related reading:

    Ah, got it.
    I have actually same problem with line 11 even I have plugin version 1.97.
    Server keep returning this
    `] PHP Fatal error: require_once(): Failed opening required ‘/var/www/html/web/app/plugins/cookies-and-content-security-policy/js/cookies-and-content-security-policy-error-message.phpwp-load.php’ (include_path=’.:/usr/local/lib/php’) in /var/www/html/web/app/plugins/cookies-and-content-security-policy/js/cookies-and-content-security-policy-error-message.php on line 11, referer:
    praha19-web_nginx-php.1.f5ctnm4tgq78@vpsli4076 | [Mon Jan 03 13:34:31.051332 2022] [php7:warn] [pid 51] [client] PHP Warning: require_once(/var/www/html/web/app/plugins/cookies-and-content-security-policy/js/cookies-and-content-security-policy-error-message.phpwp-load.php): failed to open stream: No such file or directory in /var/www/html/web/app/plugins/cookies-and-content-security-policy/js/cookies-and-content-security-policy-error-message.php on line 11
    praha19-web_nginx-php.1.f5ctnm4tgq78@vpsli4076 | [Mon Jan 03 13:34:31.051356 2022] [php7:error] [pid 51] [client] PHP Fatal error: require_once(): Failed opening required ‘/var/www/html/web/app/plugins/cookies-and-content-security-policy/js/cookies-and-content-security-policy-error-message.phpwp-load.php’ (include_path=’.:/usr/local/lib/php’) in /var/www/html/web/app/plugins/cookies-and-content-security-policy/js/cookies-and-content-security-policy-error-message.php on line 11`

    Line 11 is this:

    require_once( explode( ‘wp-content’, __FILE__)[0] . ‘wp-load.php’ );

    Any suggestions?

    Plugin Author Johan Jonk Stenström


Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.