Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am working on the CSS of my wordpress site. When I make changes and refresh the page the changes are not reflected. When I clear the browser history and cache the changes are still reflected. When I view the source code of the page and look at the css file it has the old content before the change. How do I get this to update so I can develop?

share|improve this question
    
Do you have a caching plugin running? Your CSS files could be cached on the server. –  Pat J Jul 23 '13 at 13:09
    
It does not appear I have a caching plugin. –  David Tunnell Jul 23 '13 at 13:12
    
Does it work if you're not using WordPress? For instance, a file called test.html and an associated .css file? –  Pat J Jul 23 '13 at 15:02
add comment

2 Answers

It is possible that your host is using something like Varnish to cache your site's output. I ran into this with a client's site hosted on a cut-rate shared hosting account. The only remedy I found was to just be patient.

share|improve this answer
add comment

Add a random version number at the end of the css file you are attaching. If you are using 'wp_enqueue_style' or wp_register_style functions, pass a random (version) number rand(111,9999) to 4th parameter. If you are attaching css as an html tag, you should add "?ver=<?php echo rand(111,999)?>" at the end of the file name. Examples are here

wp_register_style( 'custom-style', get_template_directory_uri() . '/css/custom-style.css', array(), rand(111,9999), 'all' );

or

<link rel="stylesheet" type="text/css" href="http://website.com/css/custom-style.css?ver=<?php echo rand(111,999)?>">

It will avoid caching on client end caching and possibly server caching too.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.