“wp_enqueue_style();” don’t load new edited style

Another solution is to use filemtime for the cachebusting, so that the last modified timestamp is used as the querystring variable.

This has the advantage that of still using the browser cache, and yet, a new file is served when the file is actually changed because the querystring changes. eg.

$lastmodtime= filemtime(get_stylesheet_directory().'/style.css');
wp_enqueue_style('whatever', get_stylesheet_uri(), array(), $lastmodtime);

Leave a Comment