wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



get_post_mime_type › WordPress Function

Od2.0.0
Przestarzałyn/a
get_post_mime_type ( $post = null )
Parametry:
  • (int|WP_Post) $post Optional. Post ID or post object. Defaults to global $post.
    Wymagane: Nie
    Domyślny: null
Powrót:
  • (string|false) The mime type on success, false on failure.
Zdefiniowane na:
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.


Źródło

function get_post_mime_type( $post = null ) {
	$post = get_post( $post );

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

	return false;
}