Workarounds for WordPress 4.9 Template File Caching
Caching is a devil’s bargain: it makes things faster by showing you old versions of those things. This results in many of the most frustrating debugging experiences of a developer’s life; in my work, if something’s broken, the explanation is caching until proven otherwise—much like the default explanation for loose ends in the Star Wars universe is the Force.
WordPress 4.9 now caches the active theme’s files in an attempt to speed the CMS up generally, and things are breaking. There’s no way to clear this cache by default: it lives in a transient, and unless you know that, and how to clear transients, then you’re stuck waiting up to an hour for changes you make to your theme files to come through.
This is the first time in recent memory that a WordPress version update has added a feature that can reasonably be expected to break things for large numbers of users, without giving users a tool to fix that disruption. That’s sort of disappointing. On the other hand, I suppose it does force people billing themselves as WordPress developers to get a bit more educated, which I’m all for in general.
In the meantime, if you need to clear that cache, there’s a good Reddit thread offering workarounds, a plugin that clears the cache, a plugin that adds a button for clearing the cache yourself, and other solutions. The linked article is code for your theme’s
functions.php that clears the transient responsible for the caching on each page load.
Image credit: Sam Beebe
Want More Like This?
Join our mailing list and you'll get weekly WordPress tutorials, plus news and tools from around WordPress. You'll also get a free five-day mini-course about the core concepts in WordPress![mc4wp_form]
Add a comment