Return to Snippet

Revision: 67812
at October 30, 2014 20:03 by burnandbass


Initial Code
//Removes version number from scripts and styles
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 ){
		return substr( $src, 0, $version_str_offset );
	} else{
		return $src;
	}
}
add_filter( 'script_loader_src', 'remove_src_version' );
add_filter( 'style_loader_src', 'remove_src_version' );

Initial URL

                                

Initial Description
Put it in functions.php

Initial Title
Wordpress - remove the version number from styles and scripts

Initial Tags
number, wordpress

Initial Language
PHP