Uses
Uses | Description |
---|---|
wp-includes/post.php: wp_attachment_is() | Verifies an attachment is of a given type. |
wp-includes/post.php: get_post() | Retrieves post data given a post ID or post object. |
Determine if the supplied attachment is for a valid attachment post with the specified MIME type.
(int|WP_Post) (Required) Attachment post ID or object.
(string) (Required) MIME type.
(bool) Is matching MIME type.
File: wp-includes/widgets/class-wp-widget-media.php
public function is_attachment_with_mime_type( $attachment, $mime_type ) { if ( empty( $attachment ) ) { return false; } $attachment = get_post( $attachment ); if ( ! $attachment ) { return false; } if ( 'attachment' !== $attachment->post_type ) { return false; } return wp_attachment_is( $mime_type, $attachment ); }
Version | Description |
---|---|
4.8.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_widget_media/is_attachment_with_mime_type