WordPress at a glance

wp_get_additional_image_sizes() WP 4.7.0

Gets data of all additionally registered image sizes (thumbnails).

By default WordPress has four image sizes: thumbnail, medium, medium_large, large. Using add_image_size() function, You can add additional image sizes. Now, to get all these extra sizes, you can use this function.

  • Uses global variable $_wp_additional_image_sizes.
✈ 1 time = 0.000024s = very fast | 50000 times = 0.01s = speed of light | PHP 7.1.5, WP 4.8.2

No Hooks.

Return

Array. Additional images size data.

Usage

wp_get_additional_image_sizes();

Examples

#1 Get additional image sizes

We will get such array if to use this function for twentyfifteen theme that has one additional image size: post-thumbnail.

print_r( wp_get_additional_image_sizes() );

/* Output
Array(
	[post-thumbnail] => Array(
		[width]  => 825
		[height] => 510
		[crop]   => 1
	)
)
*/

Code of wp get additional image sizes: wp-includes/media.php WP 5.2.2

<?php
function wp_get_additional_image_sizes() {
	global $_wp_additional_image_sizes;
	if ( ! $_wp_additional_image_sizes ) {
		$_wp_additional_image_sizes = array();
	}
	return $_wp_additional_image_sizes;
}

Related Functions

From tag: image (not thumbnails funcs)

More from category: Thumbnails

No comments
    Hello, !     Log In . Register