Created
November 9, 2010 23:01
-
-
Save thefuxia/670009 to your computer and use it in GitHub Desktop.
WordPress: Removes the version parameter from the script URI for the Google CDN.
This file contains 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
<?php | |
// for the functions.php | |
add_filter('script_loader_src', 'toscho_script_loader_filter'); | |
/** | |
* Removes the version parameter from the script URI for the Google CDN. | |
* | |
* @param string $src Original script URI | |
* @return string | |
*/ | |
function toscho_script_loader_filter($src) | |
{ | |
// Not our business. | |
if ( FALSE === strpos($src, 'http://ajax.googleapis.com/') ) | |
{ | |
return $src; | |
} | |
// Separate the version parameter. | |
$new_src = explode('?', $src); | |
// Just the URI without the query string. | |
return $new_src[0]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment