ホームページ制作|札幌
北海道札幌市北区北6条西6丁目2-1朝日プラザ偕楽園506号室
営業時間 7:00-24:00 TEL/FAX 011-768-8116
代表:グレン チャールズ ロウ
ただいま23人がオンライン中:ゲスト16人7 検索ボート,

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.