Skip to content

Instantly share code, notes, and snippets.

@imjjss
Created May 18, 2012 06:39
Show Gist options
  • Save imjjss/2723589 to your computer and use it in GitHub Desktop.
Save imjjss/2723589 to your computer and use it in GitHub Desktop.
Media Library Tabs
<?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