Introduce `has_image_size( $name )`, a utility function that helps avoid loading the `$_wp_additional_image_sizes` global.

Props mordauk.
Fixes #26951.



git-svn-id: https://develop.svn.wordpress.org/trunk@27128 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2014-02-08 00:19:29 +00:00
parent d6cb8c399e
commit d80685a46b
1 changed files with 14 additions and 0 deletions

View File

@ -190,6 +190,20 @@ function add_image_size( $name, $width = 0, $height = 0, $crop = false ) {
$_wp_additional_image_sizes[$name] = array( 'width' => absint( $width ), 'height' => absint( $height ), 'crop' => (bool) $crop );
}
/**
* Check if an image size exists
*
* @since 3.9.0
*
* @param string $name The image size name.
* @return bool True if it exists, false if not.
*/
function has_image_size( $name = '' ) {
global $_wp_additional_image_sizes;
return isset( $_wp_additional_image_sizes[$name] );
}
/**
* Registers an image size for the post thumbnail
*