Remove Version Number From CSS & JS in WordPress Theme
Test Project 1
You want to remove the version number from the CSS & JS in your WordPress theme.
Go to your theme folder and open the functions.php file.
You can add the code below code to the bottom of your functions.php file. It is best to add this to the child theme if possible so updates of the main theme don’t remove the code.
// Remove WP Version From Styles
add_filter( ‘style_loader_src’, ‘sdt_remove_ver_css_js’, 9999 );
// Remove WP Version From Scripts
add_filter( ‘script_loader_src’, ‘sdt_remove_ver_css_js’, 9999 );
// Function to remove version numbers
function sdt_remove_ver_css_js( $src ) {
if ( strpos( $src, ‘ver=’ ) )
$src = remove_query_arg( ‘ver’, $src );
return $src;
}
After adding the code upload the file to your server.
Remove Version Number From CSS & JS in WordPress Theme
Test Project 1
You want to remove the version number from the CSS & JS in your WordPress theme.
Go to your theme folder and open the functions.php file.
You can add the code below code to the bottom of your functions.php file. It is best to add this to the child theme if possible so updates of the main theme don’t remove the code.
// Remove WP Version From Styles
add_filter( ‘style_loader_src’, ‘sdt_remove_ver_css_js’, 9999 );
// Remove WP Version From Scripts
add_filter( ‘script_loader_src’, ‘sdt_remove_ver_css_js’, 9999 );
// Function to remove version numbers
function sdt_remove_ver_css_js( $src ) {
if ( strpos( $src, ‘ver=’ ) )
$src = remove_query_arg( ‘ver’, $src );
return $src;
}
After adding the code upload the file to your server.
The rest will be covered in the lesson.