I would like to unset image sizes before uploading images that are not meant to be featured images. Right now I have a clunky workflow where, whenever I upload images, I comment out the custom image sizes use for featured images, then bulk upload non-featured images. Then I uncomment those lines and then upload the featured images. I have a photosite with thousands of photos so making sure I don't have useless image sizes for non-featured images is important.
I would like to know if there is a way to add a checkbox (probably via a plugin that I create) to the upload new media page at Dashboard > Media > Add New, when checked, it will run a simple piece of code before the media is uploaded.
This is the code I would run if he box is checked.
function disable_featured_image_sizes($sizes)
{
unset($sizes['my_small_square']);
return $sizes;
}
add_filter('intermediate_image_sizes_advanced', 'disable_featured_image_sizes');
My problem is I don't know if it's possible to add such a checkbox to the Add New Media page and, if it was possible, how to get this value in my plugin.