WordPress Version: 6.1
/**
* Checks if an image size exists.
*
* @since 3.9.0
*
* @param string $name The image size to check.
* @return bool True if the image size exists, false if not.
*/
function has_image_size($name)
{
$sizes = wp_get_additional_image_sizes();
return isset($sizes[$name]);
}