Skip to content

Instantly share code, notes, and snippets.

@llgruff
Last active November 15, 2017 14:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save llgruff/a31155be262290c796c3aba9326fdc53 to your computer and use it in GitHub Desktop.
Save llgruff/a31155be262290c796c3aba9326fdc53 to your computer and use it in GitHub Desktop.
Remove WordPress or file version [?ver=] from script and style tags in source code (for functions.php)
<?php
/**
* Remove WordPress or file version from script and style tags in source code
* @link //gist.github.com/llgruff/a31155be262290c796c3aba9326fdc53
*/
function wp_version_js_css($src) {
if (strpos($src, 'ver='))
$src = remove_query_arg('ver', $src);
return $src;
}
add_filter('style_loader_src', 'wp_version_js_css', 9999);
add_filter('script_loader_src', 'wp_version_js_css', 9999);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment