RevealTheme logo
Back to Blog

WordPress Plugin Caching Headers

WordPress Plugin Caching Headers
The RevealTheme Team

By

··3 min read

WordPress plugins sometimes set HTTP caching headers for their specific endpoints: REST API endpoints, AJAX responses, dynamic content. The headers affect how the responses get cached by browsers and CDNs.

Understanding what plugins do with caching headers helps diagnose unexpected caching behavior and improves performance for plugin-generated content.

The headers plugins commonly set

Cache-Control: max-age=N or no-cache or private. Tells caches how to handle the response.

Expires: an absolute time when the response expires.

ETag: identifier that lets caches do conditional requests.

Vary: tells caches which request headers affect the response.

The common issues

Aggressive caching of dynamic content. The plugin sets long cache for content that should be dynamic. Users see stale data.

No caching of content that could be cached. The plugin marks everything as no-cache, defeating CDN and browser cache.

Inconsistent caching across similar endpoints. Some endpoints cache; others don't; the behavior is unpredictable.

The diagnosis

Open browser DevTools Network tab. Click a specific request from the plugin's endpoints. Check the Response Headers section.

The Cache-Control header reveals the plugin's intent. Compare against what should happen.

The fix patterns

For plugins that cache too aggressively: contact the plugin developer; the caching may be configurable.

For plugins that don't cache when they could: the CDN can sometimes override the plugin's headers. Configure CDN rules to cache the URLs anyway.

For inconsistent caching: identify the cause; some plugin code paths set headers, others don't.

The REST API caching

WordPress REST API endpoints by default have no cache headers. Each request is fresh.

For read-heavy APIs (public data that's accessed frequently), caching at the CDN level can dramatically reduce origin load. The CDN configuration overrides WordPress's default.

The honest framing

Caching headers from plugins are usually invisible but affect performance significantly. For sites where plugin-generated content is performance-critical, the headers are worth examining.

For most sites, the default behavior is acceptable. The investigation is useful when specific performance issues trace to caching behavior.