I've been breaking my head on this one. I have a child theme and made changes to the style.css document. These changes did not show up in the reload of the page because there is no mention of version in the stylesheet declaration of this file.

I have found out that style.css is loaded as a foundation of the theme and that the version number in the header of style.css is supposed to show up, but it doesn't. I've tried the deregister, dequeue and requeue options that I found online, but still no go.

I have made a work around by queueing another css file for which I have added versioning based on the modification date of the file, but I am curious if others have seen this issue and have a proper solution.

2 Answers 2


Are you sure the version is included in style.css in the right way? In that case this should really work (hook with wp_enqueue_scripts):

    $theme_data = wp_get_theme();
    wp_register_style('your-style-handle', get_template_directory_uri() . '/style.css', '', $theme_data['version'], 'all');

While developing you may not want to change the file version in style.css all the time, in which case you could use filemtime( get_template_directory_uri() . '/style.css' ) in stead of $theme_data['version'] in above code. Codewise that would be the proper thing to do. Otherwise, beware of browser cache issues.

  • Thanks @cjbj! I've tried several of those different options, but none work. Adding your suggestion (with get_stylesheet_directory_uri() )just duplicates the child stylesheet, but still no version number, but I see now that I have no version numbers at all in any of the css declarations, which i did have earlier this morning. I installed a plugin to combine and minify css sheets, that might have something to do with that issue. Will see if I can resolve that first before continuing troubleshooting.
    – kls
    Dec 30, 2019 at 11:00
  • The installed (and now deactivated) plugin was indeed responsible for removing all versions. The option with $theme_data['version'] did not work, but a version number did show up with the filemtime() option. However the stylesheet is enqueued twice. I've tried to dequeue/deregister the original, but that wasn't working, what would be the proper way of doing that? The fact that the $theme_data['version'] isn't working is a bit odd, I'll look into that to see if that is an issue in my system or not.
    – kls
    Dec 30, 2019 at 15:54
  • 1
    In a parent-child-theme situation it is normal to have the stylesheet enqueued twice. See here: developer.wordpress.org/themes/advanced-topics/child-themes/…
    – cjbj
    Dec 31, 2019 at 9:30

Call me silly, but just found a way of getting it enqueued without having it as duplicate. @cjbj, I do really appreciate your help!

If you enqueue it in the child theme's function.php file (at the end of the stylesheets enqueued in there for priority sake) and make sure you use the exact same handle as the theme is registering it with (look it up in the source code of the page, but without the -css at the end), then WP will see it as already registered by the time the theme is trying its standard registration and ignore that. Using filemtime() for versioning works perfectly:

wp_enqueue_style( 'theme stylesheet specific handle', get_stylesheet_uri(), array(), filemtime(get_stylesheet_directory() . "/style.css" ) );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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