WP-Optimize Browser Cache is Caching wp-admin PHP Pages
-
Hi,
I’ve run into a serious issue with WP-Optimize’s Browser Cache feature that causes wp-admin pages to be cached by the browser, which leads to existing posts being overwritten instead of new posts being created.Important:
This behaviour has only started happening recently, despite the Browser Cache feature having been enabled for a long time without issues. Something appears to have changed (perhaps browser behaviour or how the headers are applied).What’s HappeningWhen Browser Cache is enabled, WP-Optimize inserts this rule into
.htaccess:<filesMatch "\.(x?html?|php)$"> Header set Cache-Control "private, must-revalidate, max-age=2592000" </filesMatch>Along with
ExpiresByType text/html "access 1 month".This effectively instructs browsers to cache all PHP output, including admin pages, for up to 30 days.
As a result:
- “Add New Post” may load a cached version of
post-new.php - That cached page contains the previous post’s post_ID
- Publishing then overwrites the earlier post
This is reproducible across major browsers.How to Reproduce
- Enable Browser Cache in WP-Optimize.
- Create Post A.
- Click “Add New” → browser may reuse cached page.
- Create Post B → Post A gets overwritten.
Disabling cache in browser dev tools prevents the issue.Workarounds
- Disable Browser Cache in WP-Optimize (resolves it), or
- Modify the PHP rule to:
Header set Cache-Control "private, must-revalidate, max-age=0"This stops wp-admin caching while keeping static asset caching.Why This Is Serious
- wp-admin content must never be browser-cached.
- Long-term caching of PHP is unsafe for dynamic sites.
- This results in silent data loss, which is particularly severe.
Suggestion
Browser Cache should:
- Exclude
.php, or - Exclude
/wp-admin/, or - Apply only to static assets (CSS, JS, images).
Given that this issue has only surfaced recently, it would be useful to review whether browser behaviour or plugin logic has changed.
Happy to provide further info if needed.
- “Add New Post” may load a cached version of
You must be logged in to reply to this topic.