style.css not updating on Wordpress

23,010

Solution 1

In your theme > style.css we have to add version as below

/*! 
    Theme Name: bestTheme,
    Version: 1.2
*/

initially style sheet will be loaded but "...style.css?ver=" will be null without version in styles sheet so changes will not effect. Changing the version number of stylesheet whenever you do a change to styles is a good practice and will have immediate effect on the production. Instead there will be no cache problem.

Solution 2

Even after you empty your cache it will not work because your hosting site has it to work for many days e.g. 5-10 days perhaps. I had the same problem and I contacted my hosting service and viola! They said it's about the cache settings on their servers. So you should contact your hosting so that they can update the cache settings and the one you're updating will reflect on the live site. It's not your cache it's the hosting service server's cache

Solution 3

If you are using sass, you need to compile the sass files to css folder. Please check the video below: link

Share:
23,010
jf.laloux
Author by

jf.laloux

Updated on January 14, 2021

Comments

  • jf.laloux
    jf.laloux over 3 years

    I've been struggling with this problem for days and can't find a solution.
    I've been updating my css and the changes are not reflected for a crazy reason.
    When I check the source, the style.css is this one, that is never updating :
    http://www.dogecoin.link/wp-content/themes/directory/directory/style.css?1404006283
    That is different from this one that is the good one and where the changes are reflected:
    http://www.dogecoin.link/wp-content/themes/directory/directory/style.css
    I don't know where the "style.css?1404006283" is cached and even after emptying the cache (W3 Cache) and waiting for 2days, the changes are not reflected.
    Thank you for the help!

  • jf.laloux
    jf.laloux almost 10 years
    In style.css?1404006283, do CTRL+F ".widget img{width:100%;}" Although it won't find it in the original. I cleared the cache with W3 Total Cache but no changes.
  • jf.laloux
    jf.laloux almost 10 years
    Hi! There is cache enabled, but I want to keep it that way. I just wanna know how to flush this cache. Although I did empty de cache with W3 Total Cache. Thx for the answer.
  • jf.laloux
    jf.laloux almost 10 years
    Hey! I have to contact them to empty the cache or disable it? I mean, everytime I change the style.css it would be a problem?
  • John Robertson
    John Robertson almost 10 years
    Just disable their cache so that whenever you upload a file or update a file in the live site it will take effect instantly.
  • jf.laloux
    jf.laloux almost 10 years
    Any idea about the numbers ? And why the original style.css does change?
  • John Robertson
    John Robertson almost 10 years
    @jf.laloux what do you mean?
  • jf.laloux
    jf.laloux almost 10 years
    I don't think it's a caching problem, as the changes are reflected correctly on the style.css. But analysing the source, chrome is using style.css?1404006283 that is NOT reflecting the changes
  • allenski
    allenski over 3 years
    Do you have a screenshot you can share with you answer?
  • A. Berzins
    A. Berzins over 3 years
    @allenski you should be able to see the screenshot
  • Marco Floriano
    Marco Floriano over 3 years
    Good answer, that's what i've being doing for a while. You can even set Version: 1.2.x to be more prolific.
  • Andrew Bro
    Andrew Bro over 3 years
    no it doesn't. I've added a new version number, cleared cache and even in built-in editor it shows version 1.0... what a stupid CMS(
  • MarkWalczak
    MarkWalczak almost 3 years
    Thanks a lot! This should be marked as the correct answer.