wp_attachment_is_image

Checks if the attachment is an image.

Description

wp_attachment_is_image( (null) $post = null ); 

Parameters (1)

0. $post — Optional. (null) => null
Attachment ID or object. Default is global $post.

Usage

  1. if ( !function_exists( 'wp_attachment_is_image' ) ) { 
  2. require_once ABSPATH . WPINC . '/post.php'; 
  3.  
  4. // Optional. Attachment ID or object. Default is global $post. 
  5. $post = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wp_attachment_is_image($post); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/post.php  
  1. function wp_attachment_is_image( $post = null ) { 
  2. return wp_attachment_is( 'image', $post );