Skip to content

Instantly share code, notes, and snippets.

@khoipro
Created April 13, 2016 09:09
Show Gist options
  • Save khoipro/fc7d02e4c59142a1639690b317f447d5 to your computer and use it in GitHub Desktop.
Save khoipro/fc7d02e4c59142a1639690b317f447d5 to your computer and use it in GitHub Desktop.
Remove CSS & JS version from default WordPress setting
// remove css js version
function remove_cssjs_ver( $src ) {
if( strpos( $src, '?ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'remove_cssjs_ver', 10, 2 );
add_filter( 'script_loader_src', 'remove_cssjs_ver', 10, 2 );
@khoipro
Copy link
Author

khoipro commented May 12, 2016

Or

// Remove WP Version From Styles    
add_filter( 'style_loader_src', 'sdt_remove_ver_css_js', 9999 );
// Remove WP Version From Scripts
add_filter( 'script_loader_src', 'sdt_remove_ver_css_js', 9999 );

// Function to remove version numbers
function sdt_remove_ver_css_js( $src ) {
    if ( strpos( $src, 'ver=' ) )
        $src = remove_query_arg( 'ver', $src );
    return $src;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment