Last Updated: February 25, 2016
·
1.415K
· rajeshkhatri13

Add Extra Media Type Filters to the WordPress Media Manager

<h1>Paste below code in your <i>function.php</i> file</h1>


//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' );  


</code></pre>

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Related Tags
#wordpress
Did you know?

WordPress sites collect scripts from themes, plugins, and tag managers. A compromised plugin update can add a skimmer to every page without a change in your own templates.

Security insights from Cside