To quote Mark Jaquith’s helpful post on this topic:

“If you update your WordPress theme’s style.css, you may have noticed that you have to “force-reload” your site in your browser to see the changes. This is because your browser keeps a copy of the CSS cached on your hard drive. Depending on how your server is set up, it may not check for a new version of the stylesheet for a couple hours, or longer! And even if you force-reload to see the changes, visitors who have previously accessed your site may still get the old CSS.”

That post is from 2009 and WordPress coding conventions have changed a bit since then, so I’ll provide an updated solution:

One way to solve this problem is to “version” your CSS file, by enqueueing your stylesheet and appending a timestamp to the end of it that represents when the file was last updated. And the same can be done for JavaScript files, as well. WordPress has a $ver parameter built in to the wp_enqueue_style() and wp_enqueue_script() functions for just such a purpose. Versioning your CSS & JS files looks like this:

This tells WordPress to enqueue the stylesheet/js file just as it normally would, but to append “?ver=” followed by a Unix timestamp representing when the file was last modified to the end of the filename before doing so ( see the image below). This ensures that the version of the file enqueued is the most recent, so everyone instantly sees your changes.



  1. Kit Johnson October 28, 2015 at 2:48 am


    This is brilliant. I’ve searched for a solution like this so many times. Finally found it. Thank you!

  2. Kelby Lamb August 26, 2016 at 1:57 pm


    Which file in wordpress would you post this code?

    • Kellen Mace August 27, 2016 at 12:20 pm


      Hey Kelby,

      It typically goes in the functions.php file in your theme. Just search that file for “wp_enqueue_scripts” and you should see it. If the stylesheet was named style.css, then it would look something like this:

      function km_load_theme_styles() {
      wp_enqueue_style( ‘theme-styles’, get_stylesheet_directory_uri() . ‘/style.css’, array(), filemtime( get_stylesheet_directory() . ‘/style.css’ ) );
      add_action( ‘wp_enqueue_scripts’, ‘km_load_theme_styles’ );

      Just keep in mind that any changes made to your theme would be erased if you update it. So if it’s a theme you plan on updating, you should only make changes using a child theme (more info here:

      Best of luck!

      • Marco Panichi January 10, 2017 at 3:41 am


        It doesn’t work. I still have after adding the snippet in functions.php.

        Maybe because the style is already enqueued. Maybe you have to de-enqueue and then enqueue again? Any idea?

        • Kellen Mace January 10, 2017 at 9:30 am


          Hey Marco,

          Yeah, if that stylesheet is already enqueued, WP won’t enqueue it again. One option is to find where the stylesheet is enqueued and change it there. If you’re using a child theme though, you should not do it that way. Instead, just as you suggested, in the child theme you should call wp_dequeue_style() to remove it, then immediately call wp_enqueue_style() to add it back, providing your new arguments to it. To get the URL and path to a stylesheet that’s in the parent theme, you can use get_template_directory_uri() and get_template_directory(), then append the rest of the path to those, like in the examples in this post. Best of luck!

  3. Echo Yang September 17, 2016 at 4:33 am



  4. mihail kolev October 6, 2016 at 10:10 am


    I’ve tried to make the CSS changes “go live” on my site but nothing happened. Can you please help me?
    This is the website:

    Thank you.

    • Kellen Mace October 7, 2016 at 12:24 am


      Hi Mihail,

      I can see that your theme’s style.css file does not have ?ver= followed by a unix timestamp at the end of it. See this image: You must not have used filemtime() to set the version properly. I would re-copy it from this post and make sure the timestamp is being added to the end of style.css file. In google chrome, you can go to the menu icon > More Tools > Developer tools to open the dev tools window and click the Sources tab to see all the files loaded on the current page.

  5. John Culbreth January 13, 2017 at 3:01 pm


    Thanks for the simple solution to such an annoying problem.

  6. Brittany July 9, 2017 at 4:43 pm


    What would I type into GitHub to specifically find my child theme? What key terms do I type in?

    • Kellen Mace July 17, 2017 at 6:32 am


      Hi Brittany – wherever the files for your website are stored, you can find both the parent and child theme in the /wp-content/themes/ directory.

  7. Drew July 20, 2017 at 12:07 pm


    Hi, I’m really trying to get this to work but still no luck. I know I’m loading the correct child theme css file because I’ve renamed the file several times, however it’s still not adding a version. Using google chrome’s dev tools, as you suggested, and I can see the file name change when I physically go in and change the name but no version appended. Checked my code several times and I can’t see anything wrong. Screen shot of my functions file here where I used the code: The website is Popper is the parent theme and my child theme is popper-child. Any idea where I’m going wrong? Thanks!

    • Drew July 20, 2017 at 12:41 pm


      I found the problem after a few hours of pulling my hair out. If you use the W3 Total Cache plugin you have to make sure you uncheck the box that says “Remove query strings from static resources. Resources with a “?” in the URL are not cached by some proxy caching servers.” under the browser cache settings. The code now works! Thanks!

  8. Moshe August 20, 2017 at 11:11 pm


    You can install this plugin until site is in development mode:

    This plugin make live refresh without page refreshing. Also, it’s prevent browsers cache.

    I hope I was helpful to you.

  9. Lotem June 8, 2018 at 6:33 am


    What about users update?
    I canwt I ask my users to press F9 after every change I make in my css style.

    Maybe do you have any solution for this?

    Thanks a lot,

    • Kellen Mace June 11, 2018 at 9:40 am


      Hi Lotem – If you use this method of using fimemtime() to set the version number for your stylesheet to its last modified timestamp, then your users don’t have to do anything. The next time they visit any page on the site, their browser will check to see if the locally cached version of the stylesheet matches the one on the server, and if the one on the server has a different version number, it will download a fresh copy of it and start using that immediately instead. Best of luck!

Leave a reply

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