Skip to content

Instantly share code, notes, and snippets.

@ThemeMetric
Last active September 14, 2018 21:53
Show Gist options
  • Save ThemeMetric/16caca5b66d396b26133493160094ad5 to your computer and use it in GitHub Desktop.
Save ThemeMetric/16caca5b66d396b26133493160094ad5 to your computer and use it in GitHub Desktop.
Remove Query string of css/js files
// pest this function in your theme functions.php file
// Remove Query string of css/js files
function sss_rssv_scripts() {
global $wp_scripts;
if (!is_a($wp_scripts, 'WP_Scripts'))
return;
foreach ($wp_scripts->registered as $handle => $script)
$wp_scripts->registered[$handle]->ver = null;
}
function sss_rssv_styles() {
global $wp_styles;
if (!is_a($wp_styles, 'WP_Styles'))
return;
foreach ($wp_styles->registered as $handle => $style)
$wp_styles->registered[$handle]->ver = null;
}
add_action('wp_print_scripts', 'sss_rssv_scripts', 999);
add_action('wp_print_footer_scripts', 'sss_rssv_scripts', 999);
add_action('admin_print_styles', 'sss_rssv_styles', 999);
add_action('wp_print_styles', 'sss_rssv_styles', 999);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment