has_image_size( string $name ): bool

Checks if an image size exists.

Parameters

$namestringrequired
The image size to check.

Return

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

Source

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

Changelog

VersionDescription
3.9.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.