0

I've inherited a wordpress site that has way too many image sizes being uploaded, several are not being used.

I can't seem to find where they're being created in order to remove them. I've tried searching all the theme files and plugin files for add_image_size and _set_post_thumbnail. I found a few this way but there are several more that I can't seem to find.

Where else could these be coming from?

Anybody have any ideas/suggestions?

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.