Skip to content

Instantly share code, notes, and snippets.

@thefuxia
Created November 9, 2010 23:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save thefuxia/670009 to your computer and use it in GitHub Desktop.
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.
<?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