Troubleshooting

WordPress REST API Errors: 401, 403, and the Editing Blocks That Break

Gutenberg, site editors, and half the plugin ecosystem talk through the REST API. When it returns 401/403, editors break mysteriously. The causes and fixes, mapped.

WordPress REST API Errors: 401, 403, and the Editing Blocks That Break

The block editor and the REST API are the same system: every autosave, revision, and publish button in Gutenberg is a REST request. When the API returns 401 or 403, the symptoms look unrelated — “Updating failed”, the editor refusing to load, page builders’ save buttons spinning. Here is the mapping from error to cause.

401 Unauthorized: the nonce problem

REST cookie authentication depends on a nonce that expires. Symptoms: edits fail after leaving a tab open for hours; publishing works again after refresh.

  • Fix: refresh before continuing long editing sessions. If it happens constantly, a plugin is regenerating nonces too aggressively — cache plugins caching admin Nonce responses, or aggressive Heartbeat throttling.
  • Never cache anything containing wp-rest nonces. Cache plugins that over-reach into admin context cause exactly this — the cache layer test shows which handle it correctly.

403 Forbidden: someone is blocking the door

  • Security plugins: firewalls that treat REST as an attack surface (Wordfence’s block options, iThemes-style XML-RPC/REST toggles). Whitelist the endpoints your editors need; the security plugin comparison maps who blocks what.
  • Server rules: mod_security or nginx rules rejecting /wp-json/ patterns. The site’s error log shows the rule hit; the host whitelists.
  • REST API disabled by hardening plugins: some hardening plugins disable REST for logged-out users only — that is usually safe — others disable it entirely and break the editor for everyone.

The special case: 404 on /wp-json/

Permalinks. After migrations or permalink changes, rewrite rules for REST routes vanish. Fix: re-save Settings → Permalinks, or wp rewrite flush --allow-root. If it persists, the server is missing the catch-all rewrite to WordPress — check the host’s nginx/Apache config.

Diagnose like this

  1. Visit /wp-json/ directly logged out — a JSON index means routing works; a 403 means server/security blocking.
  2. Log in and hit the specific failing endpoint (the editor’s network tab names it).
  3. Check debug.log for the corresponding PHP error — the critical error guide covers reading it.

Why does Gutenberg say 'Updating failed'?

Usually a REST API failure: expired nonce (401 — refresh the page) or a firewall blocking /wp-json/ requests (403). The browser network tab shows which request failed and with what status.


Why is /wp-json/ returning 404?

Stale rewrite rules — common after migrations. Re-save permalinks or run wp rewrite flush. If persistent, the server config lacks the catch-all route to WordPress.


Should I disable the WordPress REST API?

Restricting sensitive endpoints from logged-out users is reasonable hardening. Disabling it entirely breaks the block editor and modern plugins — not worth it on content sites.


Why do REST requests fail only for logged-out visitors?

Cookie authentication only applies logged-in. Logged-out 403s point at security plugins or server rules blocking public REST access — check the firewall logs.

The WPForge editorial team: WordPress and WooCommerce engineers with a decade of combined experience in store builds, speed optimization, migrations and plugin audits. Every guide is based on real client projects and hands-on testing, reviewed before publishing.

Revision history

  • October 2026 — Facts, version numbers and links re-verified against current vendor data.

We re-test and update our guides when tools change — see our editorial policy for how. Editorial policy →