child theme CSS ver var remove

Hi,

I'm trying to remove the ver var from child theme url (style.css?ver=20.7.2.1) for development. But the regular method of adding "null" to the enqueue line is not working, the file is giving the ver of the theme on the url.

What can I do?

Thanks,
Asaf

Comments

  • Hello Asaf,
    this is added by wordpress not by us. `
    Please add this to functions.php file, and do not use cache.
    function mfn_be_remove_css_js_ver( $src ) {
    if( strpos( $src, '?ver=' ) )
    $src = remove_query_arg( 'ver', $src );
    return $src;
    }
    add_filter( 'style_loader_src', 'mfn_be_remove_css_js_ver', 10, 2 );
    add_filter( 'script_loader_src', 'mfn_be_remove_css_js_ver', 10, 2 );
Sign In or Register to comment.