I got this code in my WordPress theme function.php file for removing Query Strings from Static Resources. However, I would like to be able to remove query strings with different arguments as well, like ?v, ?rev. I realize I just could change the “?ver” to “?”, but then it would also remove google map URL’s like “?pb” which I don’t want. How can I add multiple arguments to this code?

// Remove Query Strings from Static Resources
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 );

Read more here: Custom wordpress query string remover


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: