WordPress Theme

Update CSS On A Heavily Cached WordPress Blog

So you are running a WordPress Blog huh? And yes you are optimizing your static files by caching it by setting a very far future expiration date. But that is not the story here.

What Is Wrong With My Cache?

Actually, my real problem here is that I thought I was penalized by Google for having accidental hidden text on my theme’s CSS. I have been using this theme (the old one since as the time or writing, there is already version 2) since February and I like it.


After realizing the hidden text problem, I decided to fix some CSS problems, especially those “the same color with background color” issues. I am caching my CSS, JS and images with far future expiry date, therefore I need to change the CSS filename every time I need to change a style.

As Yahoo and the other guys suggested, the best way to handle far future cached files is to change the filename, in my case the CSS file. However, in a WordPress blog, you can’t change the style.css for this purpose. The filename is assumed by the core WordPress application as the default stylesheet file.

Simple Trick

If we can’t change the filename of the CSS file, we will change the directory name of the them instead! So whenever your heavily cached WordPress blog is accessed the next time with an updated CSS, your whole theme is retrieved as a new file to the visitors browser.

Leave a reply

Your email address will not be published. Required fields are marked *