Skip to content

Remove CSS and JS version parameter from WordPress

style.css?ver=5.2.2  =>  style.css

Simple way to remove default version query parameter from WordPress CSS and JS files, just put it in your theme’s functions.php.

// Remove wp version param | css and js
// Example: style.css?ver=5.2.2  =>  style.css
function remove_wp_ver_css_js_code_paste( $src ) {
    if ( strpos( $src, 'ver=' ) )
        $src = remove_query_arg( 'ver', $src );
    return $src;
// for css style file urls
add_filter( 'style_loader_src', 'remove_wp_ver_css_js_code_paste', 9999 );
// for js script file urls
add_filter( 'script_loader_src', 'remove_wp_ver_css_js_code_paste', 9999 );

Leave a Reply

Your email address will not be published. Required fields are marked *