/ โ† Site Audit Fixes / Yoast SEO errors
In this guide
  1. What error parsing the response to JSON means
  2. Common causes and where to look
  3. How to see what actually came back
  4. Fixes on Plesk, Apache, nginx and Cloudflare
  5. Other Yoast SEO errors and their usual fixes
  6. A worked example: blocked after a security change
  7. The fix, step by step
  8. Edge cases worth knowing
  9. Keeping Yoast working
  10. Questions and answers

What error parsing the response to JSON means

Yoast keeps a table of indexables, a compact record of every post, term and archive with its title, description, canonical and links. It builds that table through a series of background requests to REST API addresses under /wp-json/yoast/v1/, and it reads and saves other data the same way when you use the editor panel.

Each request expects a reply that is pure JSON, something like {"objects":[...],"next_url":"..."}. The error appears when the reply cannot be parsed as JSON. That happens when:

So the message is a symptom. The fix is to find out what came back instead of JSON. The same family of faults causes the block editor's The response is not a valid JSON response message, Yoast's panel failing to load, and the optimisation stopping partway through.

๐Ÿ’ก These errors do not affect what visitors or Google see on the front end. They stop Yoast keeping its data up to date, which can leave old titles, missing internal link counts or stale breadcrumbs until it is fixed.

Common causes and where to look

CauseWhat the response looks likeWhere to fix it
PHP notices shown on screenJSON preceded by Warning: or Deprecated: textwp-config.php, or the plugin causing the notice
Blank line or byte order mark before <?phpJSON with a leading space or invisible charactersTheme functions.php or a recently edited plugin file
Security plugin restricting the REST API401 or 403 with an HTML or JSON block messageSecurity plugin settings
Server firewall such as ModSecurity403 HTML page from the serverPlesk or cPanel firewall settings, server rules
Cloudflare challenge or WAF ruleHTML challenge page, often status 403Cloudflare security rules
Caching the REST APIOld or wrong JSON, or a cached HTML pageCaching plugin or CDN exclusions
PHP memory or time limitStatus 500 or an empty replyPHP settings in hosting panel
Site address mismatch301 or 302 redirect to http or another hostSettings, General, both address fields

A recent change is the best clue. If the error started after installing a security plugin, moving to a new host, adding Cloudflare or switching on HTTPS, start with that row.

How to see what actually came back

Open the page where the error appears, such as Yoast SEO, Tools. Open Chrome DevTools, choose the Network panel, filter by yoast, and start the optimisation again. Click the request that fails and look at three things: the status code, the response headers, and the Response tab. A 403 with an HTML body names the blocker; a 200 with Warning: before the JSON points to PHP; a 301 shows an address problem.

From a terminal you can test whether the REST API answers with JSON at all. The namespace index is public, so it needs no login:

curl -s -o /dev/null -w '%{http_code} %{content_type}\n' https://example.com/wp-json/
curl -s -o /dev/null -w '%{http_code} %{content_type}\n' https://example.com/wp-json/yoast/v1
curl -s https://example.com/wp-json/yoast/v1 | head -c 300

Both lines should print 200 application/json, and the last should start with {. If you see text/html, a 403, or a redirect, something in front of WordPress is changing the reply.

Turn on logging without showing errors

In wp-config.php, above the line that says to stop editing, log errors to a file instead of printing them into responses:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

Run the optimisation again and read wp-content/debug.log. Any fatal error or warning listed during the run names the file and plugin responsible. Also check Tools, Site Health, which runs its own REST API test and reports The REST API encountered an error or an unexpected result when it fails.

Fixes on Plesk, Apache, nginx and Cloudflare

Plesk and ModSecurity

On Plesk, read the domain's error logs first. They live under the vhost system folder:

sudo tail -n 50 /var/www/vhosts/system/example.com/logs/error_log
sudo tail -n 50 /var/www/vhosts/system/example.com/logs/proxy_error_log
sudo grep -i 'wp-json' /var/log/modsec_audit.log | tail -n 20

If ModSecurity is blocking /wp-json/ requests, the audit log shows the rule ID. In Plesk, open the domain's Web Application Firewall settings and switch off that specific rule ID rather than the whole firewall, then test again.

Apache and nginx

Look for rules that deny wp-json in .htaccess or in the nginx server block. Hardening guides sometimes add them to hide the REST API, which breaks the editor and Yoast. Also make sure permalink rules are present: on Apache the standard WordPress block in .htaccess, on nginx a try_files $uri $uri/ /index.php?$args; line in the main location.

Cloudflare

In Security, Events, filter by the path /wp-json/ and see which rule acted. Add a skip or allow rule for requests to /wp-json/ from logged-in sessions, or relax the specific managed rule, rather than turning protection off. Exclude /wp-json/* and /wp-admin/* from any cache everything rule.

โš ๏ธ Do not fix the error by disabling your firewall or security plugin entirely. Find the single rule that blocks the REST API and make an exception for it.

If the server returns 500 errors on these requests, the 500 errors guide and the guide to HTTP errors in WordPress cover the server side in more depth.

Other Yoast SEO errors and their usual fixes

A worked example: blocked after a security change

Example Bakery added a security plugin and, the same week, Yoast's SEO data optimisation began failing at 4 per cent with error parsing the response to JSON. The Network panel showed the request to an indexing address returning status 403 with an HTML body titled Access denied.

The curl test on /wp-json/ returned 200 application/json, so the REST API itself was working. The security plugin's log showed it had blocked the request because a rule limited REST requests per minute, and the optimisation sends many requests quickly. Raising that limit for logged-in administrators fixed it. The optimisation then completed, and running wp yoast index on the server confirmed every object was indexed.

The lesson is to read the response before changing anything. The plugin that showed the error was not the plugin that caused it.

The fix, step by step

Step 1

Capture the failing request

Open the screen showing the error, open Chrome DevTools, select the Network panel and filter by yoast. Start the SEO data optimisation or repeat the action that failed. Click the red or failed request and note its status code, the content type in the response headers and the first lines of the Response tab. This tells you whether you are dealing with PHP output, a block page, a redirect or a server error.

Step 2

Test the REST API from outside

From a terminal, request /wp-json/ and /wp-json/yoast/v1 with curl and print the status code and content type. Both should return 200 with application/json, and the body should start with a curly bracket. Also open Tools, then Site Health, in WordPress and read the REST API test. If either check fails, the problem is the REST API as a whole, not Yoast, and the fix lies with the server, firewall or a plugin.

Step 3

Log PHP errors instead of printing them

Edit wp-config.php and set WP_DEBUG and WP_DEBUG_LOG to true and WP_DEBUG_DISPLAY to false. This stops notices being printed into JSON replies, which alone fixes many cases. Repeat the failing action, then open wp-content/debug.log and look for warnings or fatal errors logged at that moment. Each entry names a file path, which tells you which plugin or theme is responsible and needs updating or replacing.

Step 4

Remove stray output in theme and plugin files

If the response shows a blank line or odd characters before the JSON, check any file you or a developer edited recently, starting with the theme's functions.php. Make sure nothing comes before the opening <?php tag, and remove any closing ?> at the very end of the file. Save the file without a byte order mark. Repeat the request and confirm the response now begins directly with a curly bracket.

Step 5

Find the security rule that blocks it

If the response is a 401 or 403 page, check your security plugin's log first, then the server firewall. On Plesk, search the ModSecurity audit log for wp-json to find the rule ID. On Cloudflare, filter Security Events by the path. Make an exception for that one rule or for logged-in administrators, rather than disabling protection. Repeat the action and confirm the request now returns status 200.

Step 6

Stop caching REST and admin requests

In your caching plugin, server cache and CDN, exclude /wp-json/ and /wp-admin/ from page caching, then purge all caches. A cached HTML page or a stale JSON reply served to the admin causes the same parse error. Confirm by checking the response headers in DevTools: there should be no cache hit header on the Yoast request, and the content should change when you repeat it.

Step 7

Fix redirects and resource limits

Open Settings, then General, and make sure the WordPress Address and Site Address fields match exactly, including https and www. If the failing request returned 500 or an empty body, raise the PHP memory limit to 256M and the maximum execution time to 120 seconds in your hosting panel, or set WP_MEMORY_LIMIT in wp-config.php. Repeat the request and confirm it now returns status 200 with JSON.

Step 8

Rebuild the Yoast indexables

With the REST API answering cleanly, go to Yoast SEO, then Tools, and run the SEO data optimisation again. On large sites, run wp yoast index on the server instead, adding --reindex if earlier attempts left the data inconsistent. Back up the database before any reindex. Confirm the run completes without errors and the Yoast tools screen no longer asks you to optimise your SEO data.

Step 9

Turn debugging back off and recheck

Set WP_DEBUG back to false, or leave logging on with display off if you want to keep watching, and delete a large debug.log. Open a post in the editor, check the Yoast panel loads and that saving works, and fetch the post with curl to confirm the title and description are correct. Note which rule or plugin caused the error so you can check it first if it ever returns.

Edge cases worth knowing

Keeping Yoast working

Once the REST API answers with clean JSON again, keep it that way:

  1. Keep WP_DEBUG_DISPLAY set to false on live sites so notices go to the log, never into responses.
  2. Exclude /wp-json/ and /wp-admin/ from page caching on every caching layer, from plugins to Cloudflare.
  3. After adding a security plugin, firewall rule or CDN, run the curl test and open the Site Health status screen.
  4. After large imports or migrations, run wp yoast index so the indexables match the content. The WordPress migration guide lists the other checks to make after a move.
Questions and answers

1. What does error parsing the response to JSON mean in Yoast SEO?

It means Yoast asked your site for data through the WordPress REST API and got back something that was not valid JSON. The reply might be a PHP warning printed before the data, a firewall block page, a login or challenge page, a redirect or an empty server error. Yoast cannot read it, so it stops. The cause is almost always outside Yoast itself, and you find it by looking at the actual response in the Network panel of your browser's developer tools.

2. Does this Yoast error hurt my SEO?

Not directly, because the error affects Yoast's background data, not the pages visitors and Google receive. Your published titles, descriptions and sitemap usually keep working. However, while the indexables are out of date, Yoast may show stale titles or breadcrumbs for new content, internal link counts will be wrong and some features may not work. If the same REST API block also stops the block editor saving posts, that affects your ability to publish, so fix it promptly.

3. Why does the Yoast SEO data optimisation stop partway?

It stops when one of the many background requests fails, often because a security plugin or firewall limits how many REST requests can be made per minute, or because one batch hits the PHP memory or time limit. Look at the failing request in the Network panel to see its status code. If it is 403 or 429, relax the rate limit for administrators. If it is 500, raise the PHP limits or run wp yoast index on the server instead of in the browser.

4. How do I check if the WordPress REST API is blocked?

Open Tools, then Site Health, in WordPress and read the REST API test, which reports an error or an unexpected result if it is blocked. You can also request your site address followed by /wp-json/ in a browser or with curl. A working API returns a long JSON document with status 200 and a JSON content type. An HTML page, a 401 or 403 status, or a redirect to a login page shows that a plugin, firewall or server rule is blocking it.

5. Can a security plugin cause Yoast SEO errors?

Yes, security plugins are one of the most common causes. Options that restrict the REST API, limit request rates, block unknown user agents or require extra authentication can stop the requests Yoast makes in the background. Check the plugin's activity or firewall log for blocked requests to wp-json addresses at the time of the error. Then add an exception for that rule or for logged-in administrators, rather than switching the whole security plugin off.

6. How do I reset Yoast SEO indexables?

If you have server access, run wp yoast index with the reindex option through WP-CLI, which rebuilds the indexables table from your content. Without a shell, install the Yoast Test Helper plugin, use its option to reset the indexables tables and migrations, then run the SEO data optimisation again from Yoast SEO, Tools. Back up the database before resetting. Only do this after fixing the REST API problem, or the rebuild will fail with the same error.

7. Why does the block editor say the response is not a valid JSON response?

The block editor saves posts through the same REST API that Yoast uses, so it shows this message for the same reasons: PHP notices printed into the reply, a firewall or security plugin blocking the request, a redirect caused by mismatched site addresses, or a cached page returned instead of JSON. Check the failing request in the Network panel, confirm the WordPress Address and Site Address settings match, and make sure wp-json and wp-admin addresses are excluded from caching.

Check your WordPress site after fixing Yoast

The Site Audit fetches your pages as a search engine does and reports server errors, blocked resources, missing titles and sitemap problems, so you can confirm the front end is healthy once Yoast is working again.

Open Site Audit Fixes โ†’
๐Ÿ’ฌ Got a problem?
Related Guides: All Site Audit Fixes  ·  Best WordPress SEO plugin  ·  HTTP errors in WordPress  ·  Sitemap index problems in WordPress  ·  500 internal server errors  ·  Learning Hub

About aiwebpageseo

aiwebpageseo.com is a data-driven SEO and AEO (Answer Engine Optimisation) platform providing a free suite of technical SEO tools. Rather than relying on AI-theorised assumptions, the platform analyses live URL performance, delivering objective diagnostics, page speed metrics, CLS debugging, and site crawl data alongside actionable technical tutorials.