Skip to content

Nonce Refresh for Cached Pages in Super Page Cache Pro

WordPress nonces expire over time. On long-cached pages, an expired nonce can break forms, login-related actions, carts, ratings, calendars, or other frontend interactions. Super Page Cache Pro can refresh supported nonces on cached HTML pages so visitors can keep using those interactions safely.

📝 Note: Nonce refresh is available only in Super Page Cache Pro.

Enable nonce refresh

  1. Go to WordPress Admin > Super Page Cache > Settings.
  2. On the General tab, turn on Show Advanced Settings and click Save Settings.
  3. Open the Advanced tab and scroll to the Cache section.
  4. Turn on Enable nonce refresh.
  5. Click Save Settings.
  6. Purge the full cache once so existing cached pages rebuild with nonce-refresh support.

How nonce refresh works

When a cacheable page is rendered, Super Page Cache Pro detects supported nonce actions and injects a lightweight refresh script into the cached HTML. The script requests fresh nonce values from:

text
GET /wp-json/spc/v1/nonce-refresh

The plugin then updates matching nonce values in the page so frontend actions keep working even when the page itself comes from cache.

The endpoint returns nonces only for action names that match the allowed pattern list.

Add custom nonce action patterns

If your theme or plugin uses custom nonce action names, you can extend the allowed pattern list with the spc_nonce_refresh_patterns filter.

Use this only for frontend nonce actions that are safe to refresh on cached pages for visitors.

Troubleshooting

If a cached form or frontend action still fails after enabling nonce refresh:

  1. Confirm the page is cacheable and is actually being served from cache.
  2. Purge the full cache and test again.
  3. Verify the nonce action name matches a default allowed pattern or one you added through spc_nonce_refresh_patterns.