Support » Plugin: W3 Total Cache » Refresh query string for assets

  • There’s an option in the settings: “Prevent caching of objects after settings change”

    I have this checked because I want the query string appended to my assets. However, I’m not sure what “settings changes” causes the query strings to change. I’d like to be able to force those query strings to update without clearing the entire page cache.

    Specifically, I’d like to be able to make a change to the stylesheet and have the query string read styles.css?newfoo123 — and I’m ok waiting for natural page expiration (15 min) since a full page cache purge is resource heavy. But my stylesheet expiration is set to a week and I don’t want to wait the week for users to download the updated stylesheet.

    Is there any way to force W3TC to update the query strings appended to assets?

Viewing 3 replies - 1 through 3 (of 3 total)
  • I’m interested in this as well. Seems like it would be a pretty useful feature. (Ideally, also offering style.a2b3c4.css URLs)

    Otherwise, the only way to get this feature from the plugin seems to be by minifying assets.

    You guys find an answer to this? I’m also interested…

    Ok, I’ve got a pretty decent solution for this. I’ve appended a version number to my CSS and JS based on the file modified times. This busts the cache after I deploy any changes to these files. I minify all my css and js into one file each, so I need one variable for each file, for example:

    $cacheBusterCSS = filemtime( get_stylesheet_directory() . ‘/library/css/style.css’);
    $cacheBusterJS = filemtime( get_stylesheet_directory() . ‘/library/js/scripts-ck.js’);

    wp_register_style( ‘bones-stylesheet’, get_stylesheet_directory_uri() . ‘/library/css/style.css’, array(), $cacheBusterCSS, ‘all’ );
    wp_register_script( ‘bones-js’, get_stylesheet_directory_uri() . ‘/library/js/scripts-ck.js’, array( ‘jquery’ ), $cacheBusterJS, true );

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Refresh query string for assets’ is closed to new replies.