1

I am currently using a Mac computer and I cannot figure out how to refresh my website when I make css changes. I have tried Cmd +R, I have tried emptying the caches, but nothing seems to work.

I have used a windows computer before and every time I made a style change with my style.css sheet, I would just press ctrl + F5 and it would hard refresh right away.

Does anyone know any tricks other than Cmd+R or clearing the caches?

closed as off-topic by Mark Kaplun, Nathan Johnson, Jacob Peattie, Krzysiek Dróżdż, Christine Cooper Apr 10 '18 at 17:30

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third party plugins and themes are off topic, they are better asked about at their developers' support routes." – Mark Kaplun, Nathan Johnson, Jacob Peattie, Krzysiek Dróżdż, Christine Cooper
If this question can be reworded to fit the rules in the help center, please edit the question.

3

"Quick" fix: Right Click -> view page source ( ctrl+U ), find .css file you changed, open it in new tab and reload ( you should see change in place you've made it )

ONLY in development mode add php function time() in place of version number

wp_enqueue_style( $handle, $src, array(), time() , 'all' );

Delete cache if you use caching plugin.

  • I love using the time() trick too. Especially helpful for mobile testing because phones like to cache everything and are less prone to refreshing. – MarkPraschan Apr 9 '18 at 13:50
2

If you're using cache for your styles you need to refresh cache, turn off a cache plugin or just add "time()" function to your version of your styles.

wp_enqueue_style( 'some-style', get_stylesheet_directory_uri() . '/yourpath.css', array(), time());

More info you can find here about styles in wordpress. wp_enqueue_style

0

this can actually be a complex problem and may have many dimensions:

Please define further: Are you developping locally (server, DB is on your computer) or remotely (Hosting, FTP, etc.)

Caching can be really a bitch: The WebHosting may have a Cache mechanism working (e.g. Varnish Cache) The Wordpress may have a Caching mechanism (as e.g. W3CTotalCache) With the Browser Cache you have set a long Caching for css files (.htaccess)

So if you have a good htaccess setup etc. all three caches should make it harder to refresh (specially) css changes. As mmm pointed ot, to include the version in the functions.php is a very helpful and recommended method, but doesn't always work (for example Varnish Cache)

So if you're in development, it's recommendable to turn off al caches while you are doing css changes, and stay with the "version number refresh", it's the most recommended method. If it's already a production site, I recommend you to get used to empty all three caches before the refresh (for a few changes it's no problem).

But there's no easier way, that's what caches and long-lifes are for.

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