Posted By

burnandbass on 10/30/14


Tagged

number wordpress remove versions version


Versions (?)

Wordpress - remove the version number from styles and scripts


 / Published in: PHP
 

Put it in functions.php

  1. //Removes version number from scripts and styles
  2. function remove_src_version ( $src ) {
  3.  
  4. global $wp_version;
  5.  
  6. $version_str = '?ver='.$wp_version;
  7. $version_str_offset = strlen( $src ) - strlen( $version_str );
  8.  
  9. if( substr( $src, $version_str_offset ) == $version_str ){
  10. return substr( $src, 0, $version_str_offset );
  11. } else{
  12. return $src;
  13. }
  14. }
  15. add_filter( 'script_loader_src', 'remove_src_version' );
  16. add_filter( 'style_loader_src', 'remove_src_version' );

Report this snippet  

You need to login to post a comment.