Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'style_loader_src', 'remove_src_version' );
- function remove_src_version ( $src ) {
- global $wp_version;
- $version_str = '?ver='.$wp_version;
- $version_str_offset = strlen( $src ) - strlen( $version_str );
- if( substr( $src, $version_str_offset ) == $version_str )
- $without_ver = substr( $src, 0, $version_str_offset );
- $file_path = str_replace(get_stylesheet_directory_uri(), get_stylesheet_directory(), $without_ver);
- $file_path_alt = str_replace(get_template_directory_uri(), get_template_directory(), $without_ver);
- if (file_exists($file_path)) {
- return $without_ver.'?ver='.filemtime($file_path);
- } elseif (file_exists($file_path_alt)) {
- return $without_ver.'?ver='.filemtime($file_path_alt);
- }
- else return $without_ver;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement