Advertisement
miriamdepaula

WordPress: Removendo tabs do Media Uploader (thickbox)

Sep 11th, 2011
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  1. //Remove Media Library Tab
  2. add_filter('media_upload_tabs','remove_medialibrary_tab');
  3. function remove_medialibrary_tab($tabs) {
  4.     if (isset($_GET['YOUR_CPT']) && $_GET['post_type'] == 'YOUR_CPT') {
  5.         unset($tabs["type_url"]);
  6.         unset($tabs['library']);
  7.         unset($tabs['nextgen']); //Se o plugin NextGen Gallery estiver ativado!
  8.         return $tabs;
  9.     }
  10. }
  11.  
  12. /*Outras verificações podem ser feitas, como por exemplo, nivel de usuário
  13. No exemplo abaixo, SOMENTE remove as TABS se o usuário não for administrador*/
  14.  
  15. function remove_medialibrary_tab($tabs) {
  16.     if ( !current_user_can('administrator') ) {
  17.         unset($tabs["type_url"]);
  18.         unset($tabs['library']);
  19.         unset($tabs['nextgen']); //Se o plugin NextGen Gallery estiver ativado!
  20.         return $tabs;
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement