Force Enqueued Resources to Update

Working on heavily cached servers with limited access to cPanel / server resources makes it difficult to apply website updates in a timely fashion.

Force your edits to be applied at the time that you make them by adding a timestamp to your enqueued files:

wp_register_style('extendcss',get_bloginfo('stylesheet_directory').'/extend.css?v='.date_timestamp_get(date_create()));
wp_enqueue_style('extendcss',get_bloginfo('stylesheet_directory').'/extend.css?v='.date_timestamp_get(date_create()));
 
wp_register_style('mobilecss',get_bloginfo('stylesheet_directory').'/mobile.css?v='.date_timestamp_get(date_create()));
wp_enqueue_style('mobilecss',get_bloginfo('stylesheet_directory').'/mobile.css?v='.date_timestamp_get(date_create()));

Leave a Reply

katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.