has_image_size() WordPress Function

The has_image_size() function is used to check if an image size has been registered.

has_image_size( string $name ) #

Check if an image size exists.


Parameters

$name

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


Top ↑

Return

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


Top ↑

Source

File: wp-includes/media.php

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


Top ↑

Changelog

Changelog
VersionDescription
3.9.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More