Introduce `has_image_size( $name )`, a utility function that helps avoid loading the `$_wp_additional_image_sizes` global.
Props mordauk. Fixes #26951. Built from https://develop.svn.wordpress.org/trunk@27128 git-svn-id: http://core.svn.wordpress.org/trunk@26995 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
03dda3b273
commit
2610e6d4ff
|
@ -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 );
|
$_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
|
* Registers an image size for the post thumbnail
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue