Wordpress: The REST API did not process the context query parameter correctly

In Wordpress site health check, I’m getting this notice: “The REST API did not process the ‘context’ query parameter correctly.” The problem causes errors when using the block editor in Wordpress.

Could this be the result of a setting in Cloudflare? I have a Nginx set up, and tried suggestions I’ve found in searches, such as adding a server block to nginx config like:

location ~ ^/wp-json/ {
   rewrite ^/wp-json/(.*?)$ /?rest_route=/$1 last;
}

However, that doesn’t work. Any suggestions?

From my experience with WordPress block editor and Cloudflare, sometimes you might also run into the blocked or challenged requests at Firewall Events tab.

May I ask you to check for any Firewall Events at Cloudflare dashboard, just in case? :thinking:

Regarding that, I’d also suggest you to add your origin host/server IP to the Security -> Tools -> IP Access Rules with the action “allow” for your Website just to make sure nothing is being blocked/challenged.

If you temporary pause Cloudflare using the “Pause Cloudflare for this site” option from the Overview tab of Cloudflare dashboard for your domain name, does it then normally work or still some issues? :thinking:

You could test it by following:

  1. Use the “Pause Cloudflare on Site” option from the Overview tab for your domain at dash.cloudflare.com .
  2. The link is in the lower right corner of that page.
  3. Give it five minutes to take effect, then make sure site is working as expected with HTTPS without any error

Otherwise, something might block or restrict access to the WordPress REST API, like some security plugins like Wordfence, etc.

Okay, thanks. Testing with Pause on showed it was still happening. I tried deactivating plugins, and it turned out Yoast SEO was at fault. Specifically, a setting in their “Features” section called “REST API: Head endpoint” was the culprit. Turning that off solved the problem.

I have posted in Wordpress Support for the plugin to see what they say about it.

1 Like

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