admin管理员组

文章数量:1420166

WordPress default theme CSS version problem and not loading.

After change the css code not apply the old css only load.

we manually the style version the new code load.

style.css?ver=5.1 to style.css?ver=5.2

How to change wordpress default theme style.css version in WordPress v 5.1

WordPress default theme CSS version problem and not loading.

After change the css code not apply the old css only load.

we manually the style version the new code load.

style.css?ver=5.1 to style.css?ver=5.2

How to change wordpress default theme style.css version in WordPress v 5.1

Share Improve this question edited Jul 13, 2019 at 6:25 fuxia 107k39 gold badges255 silver badges459 bronze badges asked Jul 13, 2019 at 4:24 SNSSNS 1731 silver badge14 bronze badges 2
  • I don’t understand the question. Why do you need to change just the version of the default theme’s CSS? – Jacob Peattie Commented Jul 13, 2019 at 4:30
  • we changed in css code not apply.. 'style.css?ver=1' then we change manually 'style.css?ver=2' it loading new code – SNS Commented Jul 13, 2019 at 4:31
Add a comment  | 

1 Answer 1

Reset to default 0

you can pass time() function in version parameter. so you dont have to change version to update a css code.

function add_dynamic_version_css_scripts() {
    wp_enqueue_style( 'dynamic-style', get_template_directory_uri() . '/css/custom-style.css','style-css', time() );
}
add_action( 'wp_enqueue_scripts', 'add_dynamic_version_css_scripts' );

let me know if this works for you.

本文标签: WordPress default theme CSS version problem and not loading