Created
May 18, 2012 06:39
-
-
Save imjjss/2723589 to your computer and use it in GitHub Desktop.
Media Library Tabs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// add a tab | |
function modify_post_mime_types($post_mime_types) { | |
$post_mime_types['application/x-shockwave-flash'] = array('Flash', 'Manage Flash', 'Flash (%s)'); | |
return $post_mime_types; | |
} | |
add_filter('post_mime_types', 'modify_post_mime_types'); | |
//remove a tab by its type | |
function modify_post_mime_types($post_mime_types) { | |
unset ($post_mime_types['audio']); | |
return $post_mime_types; | |
} | |
//remove a tab by name | |
function remove_medialibrary_tab($tabs) { | |
if ( !current_user_can( 'administrator' ) ) { | |
unset($tabs['library']); | |
return $tabs; | |
} | |
else | |
{ | |
return $tabs; | |
} | |
} | |
add_filter('media_upload_tabs','remove_medialibrary_tab'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment