diff --git a/src/wp-includes/media.php b/src/wp-includes/media.php index 89e642bd3b..b71c0b4d72 100644 --- a/src/wp-includes/media.php +++ b/src/wp-includes/media.php @@ -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 *