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

Barry Ceelen barry at multipop.org
Wed Mar 2 18:04:44 UTC 2011


There seems to be a $_GET['post_id'] available.
You could check the post type for that id with get_post_type( $_GET['post_id'] ).

On 2 Mar, 2011, at 18:54 , Olivier wrote:

> 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!
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers



More information about the wp-hackers mailing list