Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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;
}
share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

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
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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