This topic has 8 replies, 3 voices, and was last updated 6 years, 4 months ago ago by Rose Tyler
Hello,
I have cheke my site in pingdom.com
and get: https://snag.gy/WlUODb.jpg
so, I need to Remove the query string and encode the parameters into the URL
can I add the cod in functions.php in my wp-admin?
is it will be enough or I need to do it also on CPanel?
//remove quary strings
function _remove_script_version( $src ){
$parts = explode( ‘?’, $src );
return $parts[0];
}
add_filter( ‘script_loader_src’, ‘_remove_script_version’, 15, 1 );
add_filter( ‘style_loader_src’, ‘_remove_script_version’, 15, 1 );
Best Regards
Orna
Hello,
Use the code below, your code conflicts with the google fonts
// Remove query string from static files
function remove_cssjs_ver( $src ) {
// Do not do it for revslider and essential-grid.
if ( strpos( $src, 'revslider' ) || strpos( $src, 'essential-grid' ) ) return esc_url( $src );
if( strpos( $src, '?ver=' ) )
$src = remove_query_arg( 'ver', $src );
return esc_url($src);
}
add_filter( 'style_loader_src', 'remove_cssjs_ver', 10, 2 );
add_filter( 'script_loader_src', 'remove_cssjs_ver', 10, 2 );
Regards
Hello,
I need to add it on functions.php in the cPanel?
Regards
Hello,
Connect to your server using FTP or cPanel and add the code in the child theme functions.php file.
Regards
Hello Olga,
I did it but the rank sow me now
72 Remove query strings from static resources
Hello,
I see 92 score http://prntscr.com/k8geec where all the strings are plugins strings. Any string directly from our theme files.
Regards
Hello,
I think it changed again after you delete the cache plugin
It’s o.k. now as you say (:
Many thanks
Hello,
You’re welcome!
Regards
You must be logged in to reply to this topic.Log in/Sign up