remove_image_size() WordPress Function

The remove_image_size() function is a WordPress function used to remove an image size from an image. This function can be useful when you want to change the size of an image on your website or blog. This function can be used to remove an image size from an image that has already been added to your website or blog.

remove_image_size( string $name ) #

Remove a new image size.


Parameters

$name

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


Top ↑

Return

(bool) True if the image size was successfully removed, false on failure.


Top ↑

More Information

  • Useful when a plugin has registered an image size and you want to use the same image name in your theme but with a different size.
  • Cannot be used on reserved image size names.

Top ↑

Source

File: wp-includes/media.php

function remove_image_size( $name ) {
	global $_wp_additional_image_sizes;

	if ( isset( $_wp_additional_image_sizes[ $name ] ) ) {
		unset( $_wp_additional_image_sizes[ $name ] );
		return true;
	}

	return false;
}

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