Search code examples
csswordpresscaching

Wordpress CSS changes do not reflect


I am working on WP 3.5.1, the latest version with a Duotive Three theme installed in it. Everything was working fine until 2 days back, but from 2 days, whenever I edit my CSS file either through the FTP or the Wordpress Admin, it does not reflect in the browser, either in the website or when I open the CSS file in the browser directly. However, the changes start reflecting a few hours later, I do not know how long exactly. But it frustrates me a lot because I need to wait for a long time to see the changes and check them. I have tried refreshing the browser with Shift + F5, I deleted browser cache, cookies and even temp files. But still it does not work. Please help. Note:- I have been working in Wordpress since around 6 years now, built more than 100 websites in Wordpress but this is the first time I am facing this problem. I tried to consult with my network of friends and spent hours googling, many had similar problems but not exactly like mine.


Solution

  • One thing that you might do is to add a version number where the css is called.

    If it is called in the head, you can do it like:

    <link rel="stylesheet" type="text/css" href="youtstylestyles.css?version=1.0" media="all" />
    

    This will make the browser refresh.

    There is also a variable in the wp_enqueue_style() function (if that is how the stylesheet is added) and if you up that it will force a refresh.