[wp-hackers] Custom post type and media upload tabs
Olivier
autremonde75 at gmail.com
Wed Mar 2 18:19:37 UTC 2011
Brilliant, works perfectly, many thanks for this Barry!
On Mar 2, 7:04 pm, Barry Ceelen <ba... at multipop.org> wrote:
> 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-hack... at lists.automattic.com
> >http://lists.automattic.com/mailman/listinfo/wp-hackers
>
> _______________________________________________
> wp-hackers mailing list
> wp-hack... at lists.automattic.comhttp://lists.automattic.com/mailman/listinfo/wp-hackers- Hide quoted text -
>
> - Show quoted text -
More information about the wp-hackers
mailing list