WordPress at a glance

wp_attachment_is_image() WP 1.0

Checks if the attachment is an image.

Notes:

  • Since 4.2.0 Modified into wrapper for wp_attachment_is() and allowed WP_Post object to be passed.
Works based on: wp_attachment_is()
✈ 1 time = 0.000291s = fast | 50000 times = 0.44s = very fast PHP 7.0.14, WP 4.7

No Hooks.

Return

true/false. Whether the attachment is an image.

Usage

wp_attachment_is_image( $post );
$post(int/WP_Post)
Attachment ID or object.
Default: global $post

Code of wp_attachment_is_image: wp-includes/post.php VER 4.9.8

<?php
function wp_attachment_is_image( $post = null ) {
	return wp_attachment_is( 'image', $post );
}

Related Functions

From tag: Conditional tags (all)

More from category: Images

No comments
    Hello, !     Log In . Register