Filename cache busting for WordPress styles and scripts

To embed custom CSS styles and scripts in WordPress you should use the wp_enqueue_script(), wp_enqueue_style(), wp_register_script() and/or wp_register_style() functions. Each of these functions allows you to define a version. By default it's the version of WordPress. The version identifier will be in the URL to the script as a query string.

The version identifier is used to expire the URL. Since the browser detects the new URL as a new resource, it will use the new instead of the cached resource.

Sadly not all endpoints respect the query string. From Google Developers:

Most proxies, most notably Squid up through version 3.0, do not cache resources with a "?" in their URL even if a Cache-control: public header is present in the response. To enable proxy caching for these resources, remove query strings from references to static resources, and instead encode the parameters into the file names themselves.

So the goal is to encode the version identifier into the filename without renaming the resource on the filesystem. This is where the following plugin comes in.
Continue reading …

Delete all Feed Cache via SQL in WordPress


The Feed-Cache of WordPress is in the database, it's in the table options and sometimes you like to delete it. With a little SQL this is done quite quickly - but be careful, there is no way back! Within WordPress I do it with the help of the Plugin Adminer, which allows a complete mySQL access and you are still able to work in the backend of WordPress. Alternatively it's also possible with phpMyAdmin for example.
Continue reading …

Feed Cache in WordPress

WordPress already offers the possibility of own functions to read feeds and use it in your blog. Since version 2.8 of WordPress, a new feature is in use for that. So there are two ways to work with feeds in WordPress, and in both functions, the data is cached. But this is not always wanted, so I show how to take influence on caching of the two functions.
Continue reading …