Switch language
wpseek on Twitter


A WordPress-centric search engine for devs and theme authors




get_post_mime_type [ ]

get_post_mime_type ( $ID = '' )
Parameters:
  • (int|WP_Post) $ID Optional. Post ID or post object.
Returns:
  • (string|bool) The mime type on success, false on failure.
Defined at:
Codex



Retrieve the mime type of an attachment based on the ID.

This function can be used with any post type, but it makes more sense with attachments.

Source

function get_post_mime_type($ID = '') {
	$post = get_post($ID);

	if ( is_object($post) )
		return $post->post_mime_type;

	return false;
}

Top Google Search Results

More ...

User discussions [ wordpress.org ]

User Note(s)