Click Here to Go To Your HomePage


Breaking

Sunday, 23 July 2017

How to remove WordPress version parameter after JS and CSS scripts

Remove query strings from static resources like style sheet and java script is one of several steps to optimize your website. This tutorial will show you how to remove WordPress version parameter after JS and CSS scripts which will help caching and speed up your website.

– Before start, go to http://tools.pingdom.com to analyze your website
– After done click to “Performance Grade” tab and “Remove query strings from static resources” dropdown.
Remove query strings from static resources
– Now back to your site then open your function.php in current theme and paste this code to your file:

// remove wp version param from any enqueued scripts
function vc_remove_wp_ver_css_js( $src ) {
if ( strpos( $src, 'ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'vc_remove_wp_ver_css_js', 9999 );
add_filter( 'script_loader_src', 'vc_remove_wp_ver_css_js', 9999 );
– Click save and Refresh your site. Now you can back to tools.pingdom.com and test it again

No comments:

Post a Comment

Adbox