Remove Versions from Scripts in WordPress

WordPress automatically adds version queries at the end of your CSS and JavaScript files when you’re enqueuing them. All you need to do to remove these script versions is to add the following code snippet in your functions.php file.

function _remove_script_version( $src ){ $parts = explode( '?', $src ); return $parts[0]; } add_filter( 'script_loader_src', '_remove_script_version', 15, 1 ); add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );

Post a Comment

To post code, use the code tag with a class language-*
Examples: code class="language-markup"code class="language-css"