Fix “The response is not a valid JSON response” in The Events Calendar (saving events)

Seeing “The response is not a valid JSON response” when you save or update an event in the block editor? That message means WordPress expected JSON from the REST API but got something else (HTML, a firewall page, a PHP warning, or nothing). Follow this checklist aimed specifically at The Events Calendar to diagnose and fix it fast.

When I try to save an event with the block editor in The Events Calendar, I get: “The response is not a valid JSON response.” How do I fix this?

Why this happens

The block editor saves content over the WordPress REST API. If the endpoint for events (/wp-json/wp/v2/tribe_events/<id>) is blocked, redirected, cached incorrectly, or outputs non-JSON (e.g., a PHP warning or HTML login/firewall page), WordPress throws this error.

Quick 5-minute diagnosis

  1. Check REST works at all (replace the domain):
    curl -I -L https://example.com/wp-json/

    Expect HTTP/1.1 200 and content-type: application/json. If you get HTML, a 301/302 chain, or 403/404, something is intercepting requests.

  2. Check the events endpoint:
    curl -I -L "https://example.com/wp-json/wp/v2/tribe_events?per_page=1"

    Again expect a 200 JSON response. Any redirect/403/HTML indicates the problem.

  3. Try saving a regular Page. If Pages save but Events fail, the issue is likely rules/plugins touching custom post types or the TEC routes.

Fixes (work through in order)

1) Reset permalinks & ensure pretty URLs are working

  1. In WordPress: Settings → Permalinks → Save (no change needed; this rewrites rules).
  2. On Apache, confirm a standard WordPress .htaccess (put this in the site root, replacing conflicting rules):
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Tip: If you have global redirects, bypass them for the REST API so it can return JSON:

# Place before other redirect rules
RewriteRule ^wp-json/?$ - [L]
RewriteRule ^wp-json/ - [L]

Nginx snippet (inside the server block):

location / {
  try_files $uri $uri/ /index.php?$args;
}
location ~ ^/wp-json/ {
  try_files $uri $uri/ /index.php?$args;
}

2) Remove firewalls/WAF/caching from REST responses

  • Temporarily disable security plugins (Wordfence, Sucuri, etc.). If saving works, re-enable and whitelist /wp-json/* and /wp-json/wp/v2/tribe_events*.
  • Ask your host to whitelist ModSecurity rules hitting /wp-json or admin cookies. Many “invalid JSON” cases are a WAF returning an HTML challenge page to the editor.
  • CDN/edge cache (e.g., Cloudflare): bypass cache for /wp-json/*. Cached HTML will break JSON parsing.

3) Fix URL / HTTPS mismatches

  • Ensure Settings → General “WordPress Address (URL)” and “Site Address (URL)” exactly match (protocol + www/non-www).
  • Behind a proxy/CDN? Use Full (Strict) SSL where applicable and avoid mixed content or forced HTTP→HTTPS redirects that affect /wp-json.

Quick checks:

# Both should return 200 with JSON (no HTML)
curl -I -L https://example.com/wp-json/
curl -I -L https://www.example.com/wp-json/

4) Silence PHP warnings & plugin/theme conflicts

  • Turn off display of PHP notices while testing:
    /* wp-config.php */
    define('WP_DEBUG', false);
    define('WP_DEBUG_DISPLAY', false);
    define('WP_DEBUG_LOG', true);
  • Temporarily switch to a default theme (e.g., Twenty Twenty-Five) and disable non-essential plugins. Re-enable in batches to find the culprit.
  • If you maintain custom code, remove stray whitespace/BOM before any <?php. Even a single space sent before JSON corrupts responses.

5) Don’t block or alter the REST API

  • Disable any “Disable REST API”/privacy plugins while testing.
  • Remove maintenance/mode or login-wall plugins affecting /wp-json/*.
  • Basic Auth on the whole site? The editor’s REST calls may not include credentials. Whitelist /wp-json/* or remove Basic Auth.

6) The Events Calendar specifics

  • Update to the latest version of The Events Calendar (and Event Tickets if installed).
  • Exclude these from caches/WAF: /wp-json/wp/v2/tribe_events* (editor save) and /wp-json/tribe/events/v1/* (plugin’s public API).
  • Resave permalinks after any TEC update or when changing event slugs.

7) Large or complex events (timeouts)

  • Very heavy events (many blocks/embeds) can time out. Raise limits temporarily:
    /* php.ini or .user.ini */
    max_execution_time = 120
    memory_limit = 256M
  • If your host offers application logs, check for 499/504 on the REST routes and increase upstream timeouts.

Verification checklist

  • https://example.com/wp-json/ returns 200 with JSON headers (no redirects/HTML).
  • https://example.com/wp-json/wp/v2/tribe_events?per_page=1 returns 200 JSON.
  • Saving Pages and Events both succeed; no PHP notices are written to output.
  • /wp-json/* bypasses WAF/caching/redirect rules.

Still stuck?

Capture failing responses with your browser’s Network tab while saving an event. Look at the failing /wp-json/wp/v2/tribe_events/ID request, its Status, Response (HTML? JSON?), and Headers will point to the exact blocker.

Need human WordPress help?

WP Assistant is a free tool created by Atiba Software, a WordPress design and development company located in Nashville, TN. If you need more personalized WordPress assistance let us know, and we’ll get back to you ASAP!