I have an issue with the child theme stylesheet being browser cached, and I need to dequeue/reregister, then re-enqueue with a timestamp for the version number. The dequeue then re-enqueue is working fine, but no matter what I try there isn’t a version number being appended. I’ve tried to set the version parameter of wp_enqueue_style() to both true, and a string. No matter what there isn’t a version number added as a query string to the stylesheet link href. My full code snippet is below.

function custom_dequeue_enqueue_child_styles() {

    wp_dequeue_style('mk-style');
    wp_deregister_style('mk-style');

    $cacheBuster = filemtime(get_stylesheet_directory() . '/style.css');

    wp_enqueue_style('jupiter-child-stylesheet', get_stylesheet_directory_uri() . '/style.css', array(), $cacheBuster, 'all');

}

add_action( 'wp_enqueue_scripts', 'custom_dequeue_enqueue_child_styles', 999999999);

Read more here: Enqueued Stylesheet Version Number Not Being Appended


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: