Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a wordpress site. Now I am using a theme and I am substantially overwriting the styles in the stylesheet (style.css) by using inline styles and !important. Problem is that when I refresh the browser, the old styles return. When I press ctrl + f5, my new styles are applied. Ok fine you think... Problem is that even when I completely erase my browsers history, cookies etc, and i load the page with f5, it loads the old styles again. So the only time when it actually loads my new styles are when I press ctrl+f5. I tried different browsers and I do not have any cache plugins on my site...

What can the problem be? Thank you

share|improve this question
This does not sound like a WordPress problems to me. If the old stylesheet is not on the server, then WordPress can't serve it. That means the problem is your browser, server caching, or a caching proxy between you an the server, or maybe something I haven't thought about, but not WordPress. Make sure that the old stylesheet is not online, and disable any caching while you work. Disable your browser's cache too. Also, work on a local copy of the site. You will regret it eventually if you don't. – s_ha_dum Feb 17 at 14:47

closed as off topic by s_ha_dum, toscho Feb 17 at 15:47

Questions on WordPress Answers are expected to relate to WordPress within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.

1 Answer

Try to add it in the functions.php:

add_filter( 'stylesheet_uri', 'wpa_87248_add_style_version' );
function wpa_87248_add_style_version( $url ) {
    $file = get_stylesheet_directory() . '/style.css';
    $version = filemtime( $file );
    return $url . '?v=' . $version;
}
share|improve this answer

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