0

I'm trying to use the script below in order to disable automatic thumbnail generation when images are uploaded via the media manager.

I'd like to leave the thumbnail option intact when an image is uploaded directly to a post, because that uploader gives the user the ability to specify the image size.

The problem is that it disables thumbnail options in both places. I want to allow thumbs everywhere except the media manager upload.

if ($pagenow == 'media-new.php' || $pagenow == 'async-upload.php'){
    add_filter('intermediate_image_sizes_advanced','disable_thumbnails');
    }

function disable_thumbnails($arr_sizes){
    if(!stristr($_POST['type'], 'image')){
        return array();
    }
    return $arr_sizes;
}
1

Not sure if I've understand this correctly but you should be able to check which tab is currently open by looking at $_GET['tab']

  • upload new tab = type
  • from url = type_url
  • gallery = gallery
  • media library = library

So you could wrap your code inside

if ( $_GET['tab'] != 'type' )  // do stuff

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.