CodepenLink to codepenEmail meEmail me at info@metricslice.comGitHubLink to my GitHub repositoryCall meCall me at 404-694-1204Follow me on TwitterFollow me on Twitter @thebeckyhamm
Menu

Busting the CSS Cache in WordPress

Mar 20, 2014
← Back to All Posts

I have been updating my class website's look and feel, so the site sometimes looks broken due to all of my CSS changes.

Instead of telling everybody to refresh, I did some Googling to systematically remedy this problem and found this lovely little snippet over at Gilbert Pellegrom's site that goes in the functions.php file.

  
    /* Enqueue main stylesheet */
    wp_register_style( 'style', get_template_directory_uri().'/style.css', array(), filemtime( get_template_directory().'/style.css' ) );
    wp_enqueue_style( 'style' );

Thanks, Gilbert!