How to Add support of Uploading .pdf Files in WordPress

Just received a request by contact form, to write a post about adding .pdf file in the Media uploader of WordPress, so here it is. Working lat at night though it feels awesome :)

How to Add support of Uploading .pdf Files in WordPress

Add the following function in your theme’s funstions.php file just before the ?> symbol and you are done


function add_pdf_support( $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', 'add_pdf_support' );

I hope it works well at your end.

Catch you all later.

By Freakify Editorial

The post was written by the Freakify Editorial Team. used to be managed by Awais, Maedah and their team before its acquisition.

3 replies on “How to Add support of Uploading .pdf Files in WordPress”

It is a pretty good post. This post contains useful information which helps us a lot. I visit your website often and share with my friends.

Comments are closed.