[WordPress]アップロード画像の複数サイズ自動生成停止

下記実行

update wp_options set option_value='0' where option_name = 'thumbnail_size_w';
update wp_options set option_value='0' where option_name = 'thumbnail_size_h';
update wp_options set option_value='0' where option_name = 'medium_size_w';
update wp_options set option_value='0' where option_name = 'medium_size_h';
update wp_options set option_value='0' where option_name = 'large_size_w';
update wp_options set option_value='0' where option_name = 'large_size_h';
update wp_options set option_value='0' where option_name = 'medium_large_size_w';
update wp_options set option_value='0' where option_name = 'medium_large_size_h';

 
functions.phpに下記追加

function disable_image_sizes( $new_sizes ) {
    unset( $new_sizes['1536x1536'] );
    unset( $new_sizes['2048x2048'] );
    unset( $new_sizes['post-thumbnail'] );
    unset( $new_sizes['category-thumb'] );
    unset( $new_sizes['homepage-thumb'] );
    return $new_sizes;
}
add_filter( 'intermediate_image_sizes_advanced', 'disable_image_sizes' );

add_filter( 'big_image_size_threshold', '__return_false' );