• Resolved Okoth1

    (@okoth1)


    Hi,

    I noticed that there are a couple of image sizes in the “These are all of the thumbnail sizes that are currently registered:” list that are not in my theme neither in plugins I use. I assume they come from WordPress, because I also see them in other people’s lists. Like these

    1536x1536: 1536×1536 pixels (proportionally resized to fit inside dimensions)
    2048x2048: 2048×2048 pixels (proportionally resized to fit inside dimensions)

    This increases the used space a lot.

    Some questions
    1. How can I exclude these images?
    2. Is there a way to set some unregister code in the functions.php file?
    3. Is it safe to remove those images from the uploads directory manually or could this break the site.

    I’ve never used WP-CLI btw so if it’s possible without…

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Okoth1

    (@okoth1)

    Hi,

    The answer to the first two questions I have found. WordPress indeed add image sizes from version 5.3 and this should work to remove them

    function remove_default_image_sizes( $sizes) {
        unset( $sizes['large']); // Added to remove 1024
        unset( $sizes['thumbnail']);
        unset( $sizes['medium']);
        unset( $sizes['medium_large']);
        unset( $sizes['1536x1536']);
        unset( $sizes['2048x2048']);
        return $sizes;
    }
    add_filter('intermediate_image_sizes_advanced', 'remove_default_image_sizes');

    Still love to hear your ideas on the third question.

    Thanks

    Thread Starter Okoth1

    (@okoth1)

    I thought I had found it, but the plugin still shows these sizes in the list.

    So, I’m still looking forward to an answer on the first two questions ??

    Plugin Author Renatho (a11n)

    (@renathoc)

    Hey @okoth1!

    Please, try using the intermediate_image_sizes filter instead. I believe this will help you.

    About the third question, I’d recommend you use the Delete thumbnail files for old unregistered sizes in order to free up server space. This may result in broken images in your posts and pages. option from the plugin. It’ll avoid the risk to remove accidentally something you are using and it will be easier. ??

    Thread Starter Okoth1

    (@okoth1)

    Okay thank you. I’m going to implement it.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Remove unwanted image sizes’ is closed to new replies.