has_image_size( string $name )

Check if an image size exists.

Parameters

$name

(string) (Required) The image size to check.

Return

(bool) True if the image size exists, false if not.

Source

File: wp-includes/media.php

function has_image_size( $name ) {
	$sizes = wp_get_additional_image_sizes();
	return isset( $sizes[ $name ] );
}

Changelog

Version Description
3.9.0 Introduced.

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/has_image_size