• Skip to primary navigation
  • Skip to main content

Tim Marchant

My personal online hub

  • Home
  • Bio
  • About
    • Contact
    • Privacy Policy
You are here: Home / Wordpress / Tuning / Remove query strings from static resources.

Remove query strings from static resources.

Query strings attached by WordPress to the urls of javascript and css files impact on the Page Speed score.

Thanks to Tricks Machine for this snippet:

Add to your functions.php

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 );

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

    tjmarchant
    Copyright © 2023 · Genesis Sample on Genesis Framework · WordPress · Log in