Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



get_post_mime_type ›

Seit2.0.0
Veraltetn/v
get_post_mime_type ( $ID = '' )
Parameter:
  • (int|WP_Post) $ID Optional. Post ID or post object. Default empty.
    Erforderlich: Nein
    Standard: (leer)
Gibt zurück:
  • (string|false) The mime type on success, false on failure.
Definiert in:
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.



Quellcode

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

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

	return false;
}