Created
September 11, 2014 12:56
-
-
Save michaelwilhelmsen/2bc3b5787256a6b01751 to your computer and use it in GitHub Desktop.
Remove Query Strings to Optimize Page Speed. Put in functions.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Remove Query Strings to Optimize Page Speed | |
| function _remove_query_strings_1( $src ){ | |
| $rqs = explode( '?ver', $src ); | |
| return $rqs[0]; | |
| } | |
| function _remove_query_strings_2( $src ){ | |
| $rqs = explode( '&ver', $src ); | |
| return $rqs[0]; | |
| } | |
| add_filter( 'script_loader_src', '_remove_query_strings_1', 15, 1 ); | |
| add_filter( 'style_loader_src', '_remove_query_strings_1', 15, 1 ); | |
| add_filter( 'script_loader_src', '_remove_query_strings_2', 15, 1 ); | |
| add_filter( 'style_loader_src', '_remove_query_strings_2', 15, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment