Skip to content

Instantly share code, notes, and snippets.

@ekka21
Created July 7, 2012 14:27
Show Gist options
  • Save ekka21/3066659 to your computer and use it in GitHub Desktop.
Save ekka21/3066659 to your computer and use it in GitHub Desktop.
Wordpress: Add Extra Media Type Filters to the WordPress Media Manager
function modify_post_mime_types( $post_mime_types ) {
// select the mime type, here: 'application/pdf'
// then we define an array with the label values
$post_mime_types['application/pdf'] = array( __( 'PDFs' ), __( 'Manage PDFs' ), _n_noop( 'PDF <span class="count">(%s)</span>', 'PDFs <span class="count">(%s)</span>' ) );
// then we return the $post_mime_types variable
return $post_mime_types;
}
// Add Filter Hook
add_filter( 'post_mime_types', 'modify_post_mime_types' );
// Other file type that Wordpress supports
// 'pdf' => 'application/pdf',
// 'swf' => 'application/x-shockwave-flash',
// 'mov|qt' => 'video/quicktime',
// 'flv' => 'video/x-flv',
// 'js' => 'application/javascript',
// 'avi' => 'video/avi',
// 'divx' => 'video/divx',
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment