Troubleshooting
Something is blocked by the Content Security Policy
If a widget, embed or plugin works while you're logged in but not for visitors, Kufi's Content Security Policy is blocking it. Find the blocked address in the browser console and allow it.
Why it happens
Kufi's Content Security Policy tells browsers to only load scripts, frames, images and connections from your own site and a short list of trusted services (YouTube, Vimeo, Google Maps, OpenStreetMap). That stops injected malware, but it also stops third-party tools until you allow them.
The policy only applies to visitors who aren't logged in. That's why something can work for you and fail for everyone else.
Confirm it's the policy
- Open the page in a private browser window (so you're logged out).
- Open the browser console (F12, or right-click → Inspect → Console).
- Look for messages starting with "Refused to load" or "Refused to execute", followed by "because it violates the following Content Security Policy directive".
The message names the blocked address and the directive: script-src, frame-src, img-src, connect-src or style-src.
To test without blocking anything, set Kufi → Settings → Content Security Policy to Report only. The console then only warns. Switch back to Enforce when done.
Allow a service
Add the service's domains with a small snippet in your child theme's functions.php. Each filter matches one directive:
add_filter( 'kufi_csp_script_src', function ( $hosts ) {
$hosts[] = 'https://widget.example.com';
return $hosts;
} );
add_filter( 'kufi_csp_frame_src', function ( $hosts ) {
$hosts[] = 'https://calendly.com';
return $hosts;
} );
The filters are kufi_csp_script_src, kufi_csp_frame_src, kufi_csp_img_src, kufi_csp_connect_src and kufi_csp_style_src. Use the exact domain from the console message, with https://. A wildcard like https://*.example.com covers its subdomains.
Google Analytics 4 and Google Tag Manager
add_filter( 'kufi_csp_script_src', fn( $h ) => array_merge( $h, array( 'https://*.googletagmanager.com' ) ) );
add_filter( 'kufi_csp_connect_src', fn( $h ) => array_merge( $h, array( 'https://*.google-analytics.com', 'https://*.analytics.google.com', 'https://*.googletagmanager.com' ) ) );
add_filter( 'kufi_csp_img_src', fn( $h ) => array_merge( $h, array( 'https://*.google-analytics.com', 'https://*.googletagmanager.com' ) ) );
Inline scripts from plugins
Plugins that add scripts the WordPress way get the security nonce automatically and keep working. A plugin that prints raw <script> tags directly into the page is blocked. Options:
- Ask the plugin's developer to use WordPress's script functions.
- Put the plugin's code under Kufi → Custom code instead, where scripts get the nonce.
- As a last resort, set the policy to Off. Your site loses this layer of protection.
Cart and checkout
Cart, checkout and account pages already use a relaxed policy, because payment providers load their own scripts. You don't need to allow Stripe or PayPal.
Can't edit functions.php?
If you don't have a child theme or can't add code, contact support with the console message and we'll tell you exactly what to add.
More in Troubleshooting
Still need help?
Tell us what you are trying to do and what you see. We read every message.