Remove Query string from Static Resources in WordPress
Query String is bad factor in terms of SEO. When we use GTMetrix.com to check our site, they will recommend to remove query string from url of static resources in WordPress.
ex. https://bwcreative.in/kb/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1
?ver=1.2.1
is query string.
If you want to remove query string then insert below code in your theme’s function.php
file
function _remove_script_version( $src ){
$parts = explode( '?ver', $src );
return $parts[0];
}
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );