Skip to content

Instantly share code, notes, and snippets.

@mattboon
Created November 14, 2012 15:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattboon/4072631 to your computer and use it in GitHub Desktop.
Save mattboon/4072631 to your computer and use it in GitHub Desktop.
WordPress - Add PDF filter to media library
<?php
// Add PDF filter to media library
add_filter( 'post_mime_types', 'modify_post_mime_types' );
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;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment