Core Function
View Source on Trac ↗ wp_attachment_is()
wp_attachment_is( mixed $type, mixed $post = null ) Verifies an attachment is of a given type.
Parameters 2 required
| Name / Type | Description |
|---|---|
| $type string | Attachment type. Accepts `image`, `audio`, `video`, or a file extension. Required |
| (int | | WP_Post) $post Optional. Attachment ID or object. Default is global $post. Required |
Return Value
(bool)
True if an accepted type or a matching file extension, false otherwise.
Function Information
Since Version
4.2.0
Source File
wp-includes/post.php
Advertisement