Categories
WordPress

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

[ad]

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' );
[ad]

I hope it works well at your end.

Catch you all later.

By Freakify Editorial

The post was written by Freakify Team.

This blog used to be managed by Ahmad Awais before it was acquired.

I have had been designing web pages since the early days of tables & spacers. And No – I’ve never used the scrolling marquee with Comic Sans fonts . Well, I am an Entrepreneur who left his orthodox path of Electrical Eng after graduation to become a UX Engineer/Marketer & a Motivational Speaker. Read more about me at AhmadAwais.com

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

Comments are closed.