For smart Primates & ROBOTS (oh and ALIENS ).

Tuesday, December 01, 2015

Remove version number from JS and CSS in WordPress

Problem:


How to Remove version number / querystring from JS and CSS in WordPress.

Solution:

goto your active theme folder and open functions.php file
and add below lines at the bottom.

function del_queryandversion_from_css_js( $style_or_js_url ) {
if ( strpos( $style_or_js_url, 'ver=' ) )
$css_js = remove_query_arg( 'ver', $style_or_js_url );
return $css_js;
}
add_filter( 'style_loader_src', 'del_queryandversion_from_css_js', 10 );
add_filter( 'script_loader_src', 'del_queryandversion_from_css_js', 10 );
Share:

Featured Post

Core Web Vitals Assessment showing LCP 10.6s while google pagespeed report showing LCP 3.5s why?

Core Web Vitals Assessment showing LCP 10.6s while google pagespeed report showing LCP 3.5s why? So, you can face this situation while...

Ads Inside Post

Powered by Blogger.

Arsip