has_image_size

Check if an image size exists.

Description

has_image_size( (string) $name ); 

Parameters (1)

0. $name (string)
The image size to check.

Usage

  1. if ( !function_exists( 'has_image_size' ) ) { 
  2. require_once ABSPATH . WPINC . '/media.php'; 
  3.  
  4. // The image size to check. 
  5. $name = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = has_image_size($name); 
  9.  

Defined (1)

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

/wp-includes/media.php  
  1. function has_image_size( $name ) { 
  2. return isset( $sizes[ $name ] );