Wordpress posting javascripts in custom HTML block

Hello community,

I am running a wordpress website and i have a problem on the admin side, post page, custom HTML block, when i try to add a piece of JavaScript in it, its a simple widget displaying stock price data.

I got error “Updating failed. The response is not a valid JSON response” when i try to update or post.

Digging a little into this issue with developer console i find out there is bunch of Json script being called from https://c0.wp.com/c/6.4.2/wp-includes/js/dist/api-fetch.min.js
that might be the cause of the issue since the the request returned error “403 forbidden” in console and triggered the wp error.

Please advise a solution for this problem, there might be a way to solve this problem, allowlist or allow external files called within wordpress.

Hi,

If Cloudflare is blocking these requests, you need to first identify which Cloudflare security service is performing the blocks, then adjust your settings accordingly:

Please visit your website and perform the action that would normally result in requests being blocked. Make sure you have Developer Tools open (F12).

  1. Wait a few minutes
  2. Go to Dashboard > Security > Events. If the request was in fact blocked by Cloudflare, you should find an event related to that block action. Depending on your site traffic, you may need to filter by IP address, User Agent, URI Path, etc. to find it. Check the “Service” that blocked it.
  3. If this was
    a) Bot Fight Mode, disable this feature.
    b) Super Block Fight Mode, create a WAF Custom Rule to Skip it for the specific situation, with relevant conditions such as the URI Path and the visitor’s IP, for example;
    c) WAF Managed Rule, you need to create a WAF Exception for that rule. See: Add a WAF exception in the dashboard · Cloudflare Web Application Firewall (WAF) docs
    d) WAF Custom Rule, you need to edit it accordingly.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.