WordPress优化:禁用网站静态资源版本查询

Author: 陌小雨Date: 2020-09-01View: 151

今天再分享要给小技巧给大家,禁用wordpress静态资源版本号:

/** Remove Query strings from Static Resources. */
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 );