|
↳ See all 15 articles
/ Documentation /Troubleshooting/ Troubleshooting: “The Response Is Not a Valid JSON Response”

Troubleshooting: “The Response Is Not a Valid JSON Response”

Saving changes under Appearance > Widgets can fail with the message “Updating failed. The response is not a valid JSON response.” This guide explains what causes that error and how to identify the exact source on your site.

Note: This message comes from WordPress core, not from the Astra theme. It can appear on any WordPress site that uses the block based Widgets screen, no matter which theme is active. The steps below apply to the free version of Astra as well as Astra Pro.

Before You Begin

A few quick checks rule out the simplest causes and make the rest of the troubleshooting safer to perform.

  1. Test on a staging copy of the site rather than the live site wherever possible.
  2. Take a full backup of the site before making changes.
  3. Clear every layer of cache: any caching plugin, server side cache, CDN, and the browser cache.
  4. Confirm WordPress, the Astra theme, and the Astra Pro Addon are all updated to the latest versions.
  5. Reproduce the error once more after completing steps 1 to 4, so you know it is still present before you start diagnosing.

Why This Error Appears

Understanding what happens behind the Update button makes the rest of this guide much faster to follow.

Since WordPress 5.8, the Appearance > Widgets screen uses the block editor. When you click Update, the browser does not submit a normal form. It sends the changes to the WordPress REST API, specifically to the /wp-json/batch/v1 endpoint, and expects a response in JSON format.

If anything returns something other than clean JSON, such as an HTML error page, a firewall block page, or a stray PHP warning, the editor cannot read the reply and displays the invalid JSON message. The error therefore describes a symptom, not a cause. The goal of the steps below is to find out what is interfering with that request.

On some pages in the WordPress dashboard, you may notice blank pages or issues loading the options. For example, if the Astra Settings page appears empty or the license activation does not work – keeps loading- it is possible the REST API is not working as expected.

Step 1: Check Whether the REST API Is Reachable

This single check splits the problem in two and usually takes under a minute.

  1. Log in to the WordPress dashboard.
  2. Open a new browser tab and visit https://example.com/wp-json/, replacing example.com with your own domain.
  3. Look at what loads:
  • A long page of JSON text means the REST API is reachable, so continue to Step 2.
Healthy REST API Response
  • A message such as “Forbidden, you don’t have permission to access this resource”, a 403 page, or any other styled error page means something is blocking the REST API before WordPress can answer. Go to the sections “REST API Blocked at Server Level” and “A Plugin Is Restricting the REST API” below.
Restricted REST API

Step 2: Watch the Save Request

If the REST API loads normally, the next step is to watch the exact request that fails. Browser developer tools show the real response the editor receives.

  1. Go to Appearance > Widgets.
  2. Press F12 to open the browser developer tools, then select the Network tab.
  3. Make a small change to any widget and click Update.
  4. In the list of requests that appears, look for one containing batch/v1.
  5. Click that request and check its status code and response:
  • A status of 403 means the request is being blocked, most often by a firewall or a security plugin.
  • A status of 500 points to a PHP error during the save.
  • A status of 200 with HTML instead of JSON means something is printing extra output into the response.

After noting the status code, use it to jump to the matching section below.

REST API Response Request in Network Tab

Common Issues

The sections below are ordered by how often each cause appears, starting with the most common.

Issue 1: REST API Blocked at Server Level

Symptom: https://example.com/wp-json/ shows a Forbidden or 403 page instead of JSON, or the batch/v1 request returns a 403.

Cause: A firewall, web application firewall, or security rule running on the hosting server is refusing requests to the REST API. This sits outside WordPress, so no plugin or theme setting will change it.

Fix:

  1. Confirm no security plugin is active on the site. If one is, test that possibility first using the next section.
  2. If no security plugin is involved, the block is on the hosting side.
  3. Contact your hosting provider and ask them to check for any rule blocking requests to /wp-json/. The section “What to Send Your Hosting Provider” below contains a message you can copy.

Expected outcome: Once the restriction is removed, https://example.com/wp-json/ returns JSON and widgets save normally.

Issue 2: A Plugin Is Restricting the REST API

Symptom: The REST API is blocked, and a security or performance plugin is active on the site.

Cause: Several security and optimization plugins include an option to disable or restrict the WordPress REST API. When that option is on, the Widgets screen cannot save.

Fix:

  1. Review the settings of any security or performance optimization plugin on the site and look for an option that disables, limits, or restricts the REST API.
  2. Turn that option off, then clear all caches.
  3. Return to Appearance > Widgets and try saving again.
  4. If you cannot find such an option, temporarily deactivate the plugin and test the save once more to confirm whether it is responsible.

Expected outcome: With REST API access restored, the widget save completes without the error.

Issue 3: Caching or a Reverse Proxy Is Interfering

Symptom: The error appears intermittently, or only on some pages, and the site uses server level caching or a CDN.

Cause: Caching layers are not meant to cache REST API requests. When one does, the editor can receive a stored or altered response instead of live JSON.

Fix:

  1. Clear the caching plugin cache, the server cache, and the CDN cache.
  2. In your caching plugin settings, exclude /wp-json/ from caching.
  3. If your host runs a server level cache such as Varnish, ask them to exclude /wp-json/ as well.
  4. Test the widget save again after every cache has been cleared.

Expected outcome: REST API requests reach WordPress directly and return live JSON.

Issue 4: A PHP Warning or Error Is Breaking the Response

Symptom: The batch/v1 request returns a 500 status, or returns a 200 status with visible text or HTML mixed into the response.

Cause: A PHP notice, warning, or fatal error generated by a plugin or theme is being printed into what should be a clean JSON reply. Even a single line of unexpected output is enough to break it.

Fix:

  1. Enable WordPress debug logging so errors are written to a file rather than displayed on screen.
  2. Reproduce the error by saving a widget again.
  3. Open the resulting debug.log file in the wp-content folder and look at the most recent entries.
  4. The file or plugin named in those entries identifies where the output is coming from.

Expected outcome: The log points to a specific plugin or theme file, which narrows the issue to a single component.

Issue 5: Incorrect Site Address or Permalink Settings

Symptom: The REST API returns a 404, or requests are redirected unexpectedly.

Cause: A mismatch between the WordPress Address and Site Address, or a broken permalink structure, can stop REST API routes from resolving.

Fix:

  1. Go to Settings > General and confirm that WordPress Address (URL) and Site Address (URL) are both correct and use the same protocol, either both http:// or both https://.
  2. Go to Settings > Permalinks.
  3. Click Save Changes without altering anything. This refreshes the rewrite rules.
  4. Test the widget save again.

Expected outcome: REST API routes resolve correctly and the save completes.

Issue 6: A Plugin or Theme Conflict

Symptom: None of the checks above identify a cause, and the error continues.

Cause: A conflict between the active theme and one or more plugins is interrupting the save request.

Fix:

  1. On a staging site, switch temporarily to a default WordPress theme such as Twenty Twenty-Four and try saving a widget.
  2. If the error disappears, the theme is involved. If it continues, the theme is not the cause.
  3. Restore your original theme, then deactivate all plugins and test the save once more.
  4. Reactivate the plugins one at a time, testing the widget save after each one, until the error returns. The plugin activated immediately before the error returns is the one causing the conflict.

Expected outcome: A single plugin or the theme is identified as the source, which makes the next step clear.

What to Send Your Hosting Provider

When the block is at server level, giving the host precise information saves a great deal of back and forth. Requests blocked by a firewall are often recorded in a separate security or proxy log rather than the standard access log, so it helps to say so directly.

Copy and adapt the following message:

Requests from my WordPress admin to https://example.com/wp-json/batch/v1 are being refused with a “Forbidden” response instead of the expected JSON. This endpoint is a standard part of WordPress and needs to be reachable for the widget editor to save.

Please check whether a firewall, web application firewall, mod_security, or reverse proxy rule is blocking requests to /wp-json/ on this site, and remove the restriction.

Please note that the request does reach the server, because the server is the source of the Forbidden response. If nothing appears in the site access log, the block is likely recorded in a separate security, WAF, or proxy log instead. Searching by the URL /wp-json/batch/v1 and by timestamp will be more reliable than searching by IP address.

Note: Allowlisting a single IP address is not a complete fix. The REST API needs to be reachable for any administrator from any connection, so the restriction should be removed rather than bypassed for one address.

Once the cause is resolved, visiting https://example.com/wp-json/ returns JSON, and saving a widget under Appearance > Widgets completes with a success message rather than the invalid JSON error.

Notes and Limitations

A few points are worth keeping in mind while working through this guide.

  • The same error can appear when saving posts, pages, or other block editor content. The cause is usually identical, because all of them save through the REST API.
  • Firewall rules, server configuration, and hosting level caching are managed by your hosting provider. Changes to those layers need to be made by them.
  • Editing widgets through Appearance > Customize > Widgets uses a different save path and may continue to work while Appearance > Widgets fails. That difference is a useful clue, not a permanent workaround.

If the steps above do not resolve the error, reach out to the support team through the Astra contact page.

Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
Scroll to Top