Fix WordPress Admin / PHP Cache Issue With CloudFlare Cache Everything

Hi,

So recently, I started experiencing a weird cache issue with WordPress, and I saw many other people on the web with similar issues, so I decided to come forward with a solution.

CloudFlare always cached PHP when using a Cache Everything Page Rule, but in the past, it had no effect on the WordPress admin pages as they always behaved properly like they weren’t cached at all.

But it seems like CloudFlare changed something recently, and now the cached PHP pages were causing all kinds of weird issues with WordPress, like new posts overriding older posts, save / update buttons not saving or updating, new posts not appearing in the post list until you refreshed the page, etc.

This problem was serious enough that I lost some articles and had to get my writers to rewrite entire articles because they had just vanished. I told my writers to start using Chrome with DevTools open and Disable Cache checked under Network, which temporarily solved the issue, but was not a long term solution.

The permanent solution for me was to add the following CloudFlare Page Rule:

www.website.com/*.php*

(Make sure to replace www.website.com with your actual website.)

This prevents CloudFlare from caching all PHP files from your website, with and without query strings, and it should fix the issue for good. Make sure you clear the CloudFlare cache and the WordPress cache afterwards, and I would even clear your browser’s cached images and files just to make sure.

If you were experiencing the same issue as me, I sincerely hope with will fix it for you as well.

Cheers.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.