Add .PDF Media Type To The WP Media Manager


WordPress support by default three media types: images, audio and video. And, if you want to add .PDF file type support, you can add this code in the current theme’s functions.php file. Within this function, you can select the file type using the mime type slug, the slug for PDFs is ‘application/pd’.

[php]
function mynew_post_mime_types( $post_mime_types ) {
$post_mime_types[‘application/pdf’] = array( __( ‘PDFs’ ), __( ‘Manage PDFs’ ), _n_noop( ‘PDF <span class="count">(%s)</span>’,
‘PDFs <span class="count">(%s)</span>’ ) );
return $post_mime_types;
}
/** Add Filter Hook */
add_filter( ‘post_mime_types’, ‘mynew_post_mime_types’ );
[/php]

You may also be interested in our other articles on get post content by id, remove feeds form wordpress, allow more tags in comments and disable auto generated paragraph tags.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *