Fixed: delete individual pages from cache
Greetings Donncha and thank you for WP Super Cache.
I think “Small is Beautiful”, so I choose it over other more complex caching plugins.
One glitch, however, has been bugging me ever since. The button on the admin bar to delete individual pages never works.
I use permalink structures without trailing slash (Ex: /%year%/%monthnum%/%postname%).
URLs like “http://example.com/about” look more appealing than “http://example.com/about/”
So i dig the code and found the problem. On line 385 in “wp-cache.php”, you assume the permalink structure always ends with a slash:
$path = get_supercache_dir() . preg_replace( '/:.*$/', '', $_GET[ 'path' ] );
Because i dont use trailing slashes the plugin was looking for something like “/var/www/multisite-network.com/wp-content/cache/supercache/example.com/2013/04/somepageindex.html” to delete when “prune_super_cache( $path . $cache_file, true );” was called on line 388.
So the simple and obvious solution was to use the trailingslashit function on line 385, which is precisely for what this WordPress function was created:
$path = trailingslashit( get_supercache_dir() . preg_replace( '/:.*$/', '', $_GET[ 'path' ] ) );
I hope you fix this in an upcoming version.
Thank you and best regards.
- The topic ‘Fixed: delete individual pages from cache’ is closed to new replies.