style.css not updating on Wordpress
Asked Answered
G

11

7

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!

Guth answered 30/6, 2014 at 20:7 Comment(0)
I
12

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.

Illusory answered 4/2, 2019 at 5:46 Comment(3)
Good answer, that's what i've being doing for a while. You can even set Version: 1.2.x to be more prolific.Matlock
Thanks a lot! This should be marked as the correct answer.Chemotropism
This does nothing for me.Drilling
F
4

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

Fumikofumitory answered 1/7, 2014 at 2:41 Comment(5)
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?Guth
Just disable their cache so that whenever you upload a file or update a file in the live site it will take effect instantly.Fumikofumitory
Any idea about the numbers ? And why the original style.css does change?Guth
@Guth what do you mean?Fumikofumitory
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 changesGuth
I
1

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

Inman answered 21/6, 2020 at 10:18 Comment(0)
S
0

Well, for me it seems like they are both the same. Have you tried reloading with Ctrl+F5? I have a small knowledge of Wordpress, but is there a option in the admin control panel, with which you can delete the cache?

Sprung answered 30/6, 2014 at 20:13 Comment(1)
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.Guth
C
0

double check your .htaccess file and see if that has caching enabled as well.

Cablegram answered 30/6, 2014 at 20:47 Comment(1)
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.Guth
O
0

For anyone coming back to this on a GoDaddy hosting plan, you can flush the cache in your WP-Admin area.

In the top bar where it says "Managed Wordpress" there's a "Flush Cache" menu item:

Managed Wordpress dropdown showing Flush Cache menu option

Obvert answered 26/10, 2020 at 20:23 Comment(2)
Do you have a screenshot you can share with you answer?Petrozavodsk
@Petrozavodsk you should be able to see the screenshotObvert
A
0
/*include css from child and parent theme | style.css not updating on WordPress*/

function mychildtheme_enqueue_styles() {

    $parent_style = 'parent-style';
    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'custom-style', get_stylesheet_directory_uri() . '/custom-style.css', array(), rand(111,9999), 'all' );
    wp_enqueue_style( 'custom-style', get_stylesheet_directory_uri() . '/style.css', array(), rand(111,9999), 'all' );
    
}

add_action( 'wp_enqueue_scripts', 'mychildtheme_enqueue_styles' ); // register hook
Alithia answered 13/1, 2021 at 10:17 Comment(0)
L
0

You haveto change something in the css file to make a new version of cache.

in Wordpress admin panel, Go to Custom CSS or additional CSS. The locations may be:

  • Themes > Customize > Custom CSS
  • Appearance > Customize > Additional css
  • YOUR_THEME'S_NAME > Custom CSS & JS

change something there for example add these:

.change_something {
  color: #000;
}
Logogriph answered 19/7 at 7:0 Comment(1)
What is this supposed to accomplish?Drilling
B
-1

This is because your site is fetching style.min.css. You can find your minified style css in your control panel. If you edit your style.min.css, from there you can see your changes...

Broadsword answered 7/5, 2017 at 7:53 Comment(1)
Why would you change a minified css? Inconvenient, and will soon be overwritten.Drilling
C
-2

Clear the browser cache and rrefresh! works 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.

Colier answered 28/5, 2019 at 5:27 Comment(0)
M
-4

Clear the browser cache and rrefresh! works

Mastersinger answered 21/9, 2018 at 8:39 Comment(1)
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(Jolson

© 2022 - 2024 — McMap. All rights reserved.