Quantcast
Channel: bbird.me
Viewing all articles
Browse latest Browse all 10

Purging a stubborn WP Engine CSS cache

$
0
0

Here is the scenario – you created that awesome CSS and are dying to get it online. The client also. The website is hosted on WP Engine and is using its famous aggressive caching mechanism. You save the changes into style.css or elsewhere and clear the cache. But you still see the old style.css. You do it again and again and again and that old style.css is still there.

But I’ve got a quick trick for you – version your file! As you already know, the proper way to enqueue style or script in WordPress is the following:

wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( ), '1.0.0');

The number 1.0.0 is the style version which is not always included. If you want to make sure that after every cache purging the new version is loaded, you only have to change the version number. So if you put something like:

wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( ), '1.0.1');

after you have added new changes into style.css and if clear the cache after that, the new CSS version will be loaded immediately and a ton of your nerves (and your clients’ nerves) will be saved.

You’re welcome!

(yes, this happened to me, well, countless times…)

Post Purging a stubborn WP Engine CSS cache je prvi puta viđen na bbird.me.


Viewing all articles
Browse latest Browse all 10

Trending Articles