Home Forums Backend Issues (wp-admin) Standard image sizes are displayed as available preview sizes though unset


Standard image sizes are displayed as available preview sizes though unset

  • Is that a regular behaviour. I’ve made the following modification to the functions.php file:

    //Unset default image sizes
    function test_remove_default_image_sizes( $sizes) {
    	unset( $sizes['thumbnail']);
    	unset( $sizes['medium']);
    	unset( $sizes['large']);
    	return $sizes;
    add_filter('intermediate_image_sizes_advanced', 'test_remove_default_image_sizes');
    // Custom image sizes
    add_image_size('is268', 268, 9999);
    add_image_size('is338', 338, 9999);
    add_image_size('is394', 394, 9999);
    add_image_size('is405', 405, 9999);
    add_image_size('is580', 580, 9999);
    add_image_size('is709', 709, 9999);
    add_image_size('is811', 811, 9999);
    add_image_size('is1044', 1044, 9999);
    add_image_size('is1216', 1216, 9999);
    add_image_size('is268_x15', 402, 9999);
    add_image_size('is338_x15', 507, 9999);
    add_image_size('is394_x15', 591, 9999);
    add_image_size('is405_x15', 608, 9999);
    add_image_size('is580_x15', 870, 9999);
    add_image_size('is709_x15', 1064, 9999);
    add_image_size('is811_x15', 1217, 9999);
    add_image_size('is1044_x15', 1566, 9999);
    add_image_size('is1216_x15', 1824, 9999);
    add_image_size('is268_x2', 536, 9999);
    add_image_size('is338_x2', 676, 9999);
    add_image_size('is394_x2', 788, 9999);
    add_image_size('is405_x2', 810, 9999);
    add_image_size('is580_x2', 1160, 9999);
    add_image_size('is709_x2', 1418, 9999);
    add_image_size('is811_x2', 1622, 9999);
    add_image_size('is1044_x2', 2088, 9999);
    add_image_size('is1216_x2', 2432, 9999);

    “Problem” is that the available preview sizes in the custom fields dialogue look like that
    I would have expected that Thumbnail, Medium and Large aren’t shown? Or am I wrong? Best regards Ralf

  • Hi @rpk

    Looking at the source code, I can see that ACF merges in the thumbnail, medium, large and full sizes so there is no way to remove these from the list.

    I can’t tell you why I chose to do this, perhaps I wanted to avoid a situation where theme users could not find the default sizes?

    Is this an issue for your website, or just a concern?


  • hi elliot. well in the first place it was a concern that the standard sizes haven’t been unset and removed properly and that that that might lead into troubles in the long. also i was worried that wordpress might create those image sizes too and clutter my uploads folder with unwanted weight.

    the other concern has vanished. i was just worried in the case e.g. “medium” gets selected as preview size and this image size doesn’t exist it might lead into trouble. you never know what the user in front of wp might actually do. 😉 but i’ve tested, i am using the unset thumbnail format and afc is previewing the image properly anyway. so that part is probably ok. and there are still only the image sizes i’ve defined inside the uploads folder.

    those points aside but wouldn’t it be cleaner anyway if acf would pull the formats of preview sizes dynamically from the list of available sizes. in the case thumbnail, medium and large are unset they couldn’t show up. just looks odd and confusing 😉 , but i know it behaves right so it is ok if know about that behaviour.

  • Hi @rpk

    Thanks for the follow up. I’ll consider removing the default sizes that ACF adds in, but I don’t want to cause any issues with existing websites.


  • yeah i understand that, breaking things in existing websites wouldn’t be an option at all. but wouldn’t be a check of the set sizes before the previews sizes list is generated the most secure approach and prevent troubles like that? thanks r.

  • Hi @rpk

    The problem is that some websites have unset the default sizes as you have, but are happy that ACF provides them as preview sizes for the image field.

    If these suddenly disappeared from their websites, this would cause many new forum threads.

    Thanks for understanding. i will leave them in for now.


  • I totally understand that.nothing worse than cutting a feature many people use. but i only ask myself one question. what image size is wordpress actually using if you select e.g. thumbnail even if it is unset in the functions.php. e.g. the preview size was set by default to thumbnail on my side and the image size used looked much much bigger than the thumbnail size i would have expected. i just rechecked it. if you set the preview size to thumbnail and it is unset acf and wordpress use the full size instead. same procedure if you use medium or large. always the full version is used instead of the unset one.

  • Hi @rpk

    That’s a good point. I’ll do some testing with this one and let you know.


Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Standard image sizes are displayed as available preview sizes though unset’ is closed to new replies.