Uses
Uses | Description |
---|---|
wp-includes/post.php: get_post() | Retrieves post data given a post ID or post object. |
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.
(int|WP_Post) (Optional) Post ID or post object. Defaults to global $post.
Default value: null
(string|false) The mime type on success, false on failure.
File: wp-includes/post.php
function get_post_mime_type( $post = null ) { $post = get_post( $post ); if ( is_object( $post ) ) { return $post->post_mime_type; } return false; }
Version | Description |
---|---|
2.0.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_post_mime_type