WordPress: Remove query strings from static resources

Dealing with performance optimization for website is really shit when you are not gonna able to solve it by anyway. But if you think and want it to get done successfully as soon as possible then here blow is the solution to remove query strings from static resources.

I have been working for performance optimization of websites and got the easiest way to remove query strings. Below is the code to add your theme's functions.php file

//* Remove Query Strings
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 ); 

There are available alternative ways to solve it but if you use the above function to your theme would be great rather than using a WordPress plugin.

# Alternative Solution

Code is incredibly fascinating and love to write all the time but too lazy. For the folks who is like me and would like to eat ready dinner then they always have the alternative solution on Web.

A guy has built a WP Plugin to remove query strings from static resources. You can easily download it from WordPress.org plugin's directory. 

Millennial & an introvert. Totally dashing beyond Passion. Code is poetry that never lies. Facebook or Drop Mail