📝 Fix the REST API Returning 403 for Logged-In Editors
The WordPress REST API authenticates logged-in browser requests with a nonce (wpApiSettings.nonce) that’s baked into the page’s HTML when it’s generated for a specific user session, and that nonce expires after roughly 12 to 24 hours. A full-page caching plugin that caches the HTML of an admin-facing or logged-in page serves that same baked-in nonce to every subsequent visit until the cache entry expires — so once the nonce itself expires, every REST request an editor’s browser makes (block editor autosaves, Gutenberg’s own API calls) comes back 403 rest_cookie_invalid_nonce, even though the editor is still properly logged in.
🔎 The Problem
Response: 403 Forbidden
{
"code": "rest_cookie_invalid_nonce",
"message": "Cookie check failed",
"data": { "status": 403 }
}
Cause: page cache served HTML generated hours/days earlier,
containing a wpApiSettings.nonce value that has since expired,
even though the editor's login session itself is still valid
✅ Fix: The REST API Returning 403 for Logged-In Editors
- Exclude logged-in requests and wp-admin/editor-facing pages from full-page caching, so every editor always gets a freshly generated nonce instead of a stale cached one.
- If the caching plugin supports it, set a cache lifetime shorter than the nonce’s roughly 12-24 hour window for any page a logged-in user might load the editor from.
- Have the editor do a hard refresh (not just reopen the tab) before reporting a 403 as a permissions bug — it rules out a stale cached nonce before you go looking at user roles and capabilities.
🚨 Why This Is Dangerous
- A 403 that looks like a permissions problem can send you down a hole revoking and re-granting editor capabilities when the actual cause is a caching rule, wasting time and potentially loosening access you didn’t need to touch.
A nonce baked into a cached page is only as fresh as the cache serving it — and caches don’t know when a nonce expires.





