wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes



get_post_mime_type › WordPress Function

Depuis2.0.0
Dépréciéen/a
get_post_mime_type ( $post = null )
Paramètres:
  • (int|WP_Post) $post Optional. Post ID or post object. Defaults to global $post.
    Requis: Non
    Défaut: null
Retourne:
  • (string|false) The mime type on success, false on failure.
Défini(e) dans:
Codex:

Retrieves 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( $post = null ) {
	$post = get_post( $post );

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

	return false;
}