Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Remove Gallery Tab from Media Popup WordPress

  • SOLVED

I'm looking to remove the Gallery tab from the media popup. When one or more images are attached to a post, the gallery tab appears. I need to completely remove that (without modifying core files, or using css hacks).

Unset for the media_upload_tabs hook seems to work for the library, but not the gallery for some reason:


function remove_media_tabs($tabs) {

unset($tabs['library']);
unset($tabs['gallery']);
return $tabs;

}

add_filter('media_upload_tabs', 'remove_media_tabs');


This works for the library tab, but not the gallery. Any ideas on how I can remove this functionality at a theme level?

Answers (2)

2011-11-12

Kailey Lampert answers:

Try making it run a little later

add_filter('media_upload_tabs', 'remove_media_tabs', 11);


ajgagnon comments:

Aha! That did it! Been banging my head for hours on this one. Thanks Kailey.

2011-11-12

Romel Apuya answers:

try this in your functions.php

function hide_gallery()
{
echo '<style type="text/css">#gallery-settings{display:none;}</style>';
}
add_action('admin_print_styles', 'hide_gallery');


ajgagnon comments:

Thanks Romel, but I can't use css hacks for this. I'm looking for it to be a bit more secure.


Romel Apuya comments:

add_filter('media_upload_tabs', 'remove_media_tabs', 99);