去除掉加载样式文件url后面的ver

Published
2022-12-16
浏览次数 :  17

/*-----------------------------------------------------------------------------------*/
# Remove Query Strings From Static Resources
/*-----------------------------------------------------------------------------------*/
function tie_remove_query_strings_1( $src ){
	$rqs = explode( '?ver', $src );
		return $rqs[0];

}
function tie_remove_query_strings_2( $src ){
	$rqs = explode( '&ver', $src );
		return $rqs[0];
}

if ( ! is_admin() ) {
	add_filter( 'script_loader_src', 	'tie_remove_query_strings_1', 15, 1 );
	add_filter( 'style_loader_src', 	'tie_remove_query_strings_1', 15, 1 );
	add_filter( 'script_loader_src', 	'tie_remove_query_strings_2', 15, 1 );
	add_filter( 'style_loader_src', 	'tie_remove_query_strings_2', 15, 1 );
}

  • 标签1
  • 标签1
  • 标签1
Top