How to Remove Query Strings from Static Resources without a

Estimated reading time: 2 min read|289 words
()
Quick Answer
To Remove Query Strings from Static Resources without a Plugin simply copy paste below code in your theme’s functions.php //Remove Query Strings…
Last Updated: August 7, 2026

To Remove Query Strings from Static Resources without a Plugin simply copy paste below code in your theme’s functions.php

//Remove Query Strings From Static Resources 
function smartwp_remove_query_strings_from_static_resources( $src ) {
 if( strpos( $src, '?v=' ) ){
 $src = remove_query_arg( 'v', $src );
 }
 if( strpos( $src, '?ver=' ) ){
 $src = remove_query_arg( 'ver', $src );
 }
 return $src;
}
add_filter( 'script_loader_src', 'smartwp_remove_query_strings_from_static_resources', 999 );
add_filter( 'style_loader_src', 'smartwp_remove_query_strings_from_static_resources', 999 );

Thats it now your static resources no longer have query strings attached to them!

Most Viral Tool - free SEO audit tool Tool  | AI resume tailor tool-tailor">ATS Resume Generator| Reseller Profit Tracker Generator | Freelance Invoice Generator | ADHD Planner Generator

Advertisement

How useful was this post?

Click on a star to rate it!

As you found this post useful...

Follow us on social media!

Thank you for reading this post, don't forget to subscribe!

Was this article helpful?

Let us know so we can improve our content

Written by Share Ask

The Share-Ask editorial team is comprised of industry experts dedicated to providing accurate, actionable answers to your most pressing questions. With years of experience in research and online strategy, our board ensures every article meets the highest standards of quality. For paid sponsorship & partnership, email our board of admin at admin@share-ask.com.

Share-Ask Content Expert | Verified Contributor

Share Ask

The Share-Ask editorial team is comprised of industry experts dedicated to providing accurate, actionable answers to your most pressing questions. With years of experience in research and online strategy, our board ensures every article meets the highest standards of quality. For paid sponsorship & partnership, email our board of admin at admin@share-ask.com.

Our Network Sites:

Share-Ask BestHelpTool Web1Expert Blog