image sizes – finding and removing

By default WP support 3 image sizes ie Thumbnail, Medium and Large.

If you want to remove any of these then you can use a filter “intermediate_image_sizes_advanced” to remove the default image sizes.

function wp_remove_default_image_sizes( $sizes ) {
    unset( $sizes['thumbnail'] ); // remove thumbnail support
    unset( $sizes['medium'] ); // remove medium support
    unset( $sizes['large'] ); // remove large support

    return $sizes;
}
add_filter( 'intermediate_image_sizes_advanced', 'wp_remove_default_image_sizes' );

Now if you want to know the additional image sizes other than these then you can display using

function wp_test_function() {
    global $_wp_additional_image_sizes;
    var_dump( $_wp_additional_image_sizes );
}
add_action( 'admin_init', 'wp_test_function' );

There are plugins or themes responsible for addition of different image sizes. Eg : woocommerece plugin add a new image size ie “shop_single

If you want to remove those additional image size then you can use remove_image_size() function.

Here is the code for that

function wp_remove_additional_image_sizes() {
    remove_image_size( 'shop_single' );
}
add_action( 'init', 'wp_remove_additional_image_sizes' );

For more information you can read “http://www.sourcexpress.com/remove-unused-images-wordpress/

Thanks