[wp-hackers] Custom post type and media upload tabs

Olivier autremonde75 at gmail.com
Wed Mar 2 17:54:10 UTC 2011


Hello,

I am trying to play with media upload tabs in the custom post type
edition page.

I'd like to hide the library and gallery tabs for some users. So I
have hooked on :

add_filter('media_upload_tabs','custom_media_upload_tabs');

And then my filtering code :
function custom_media_upload_tabs($tabs)
{
	unset($tabs['gallery']);
	unset($tabs['library']);

	return($tabs);
}

Now I'd like to make a segregation between my custom post type and
regular post type so that gallery and library display still appear on
regular post type.

The issue is that when the media upload thickbox is loaded, the
$_GET['post_type'] and $_GET['post'] aren't filled anymore. Therefore,
I can't verify if I am on a regular post or a custom post type to fire
my filter or not.

Is anyone aware of another global var that I could test?

Thanks a lot!


More information about the wp-hackers mailing list