WordPress at a glance
function is not described

_wp_get_image_size_from_meta() WP 4.4.0

Get the image size as array from its meta data.

Used for responsive images.

No Hooks.


Array/true/false. Array of width and height values in pixels (in that order) or false if the size doesn't exist.


_wp_get_image_size_from_meta( $size_name, $image_meta );
$size_name(string) (required)
Image size. Accepts any valid image size name ('thumbnail', 'medium', etc.).
$image_meta(array) (required)
The image meta data.


Since 4.4.0 Introduced.

Code of wp get image size from meta: wp-includes/media.php WP 5.2.2

function _wp_get_image_size_from_meta( $size_name, $image_meta ) {
	if ( $size_name === 'full' ) {
		return array(
			absint( $image_meta['width'] ),
			absint( $image_meta['height'] ),
	} elseif ( ! empty( $image_meta['sizes'][ $size_name ] ) ) {
		return array(
			absint( $image_meta['sizes'][ $size_name ]['width'] ),
			absint( $image_meta['sizes'][ $size_name ]['height'] ),

	return false;