WordPress.org

Ready to get started?Download WordPress

Forums

How to remove custom media sizes? (3 posts)

  1. José Luís
    Member
    Posted 4 years ago #

    It's somewhat well-known how to add custom media sizes by using:
    add_image_size( HANDLE, WIDTH, HEIGHT, CROP );

    But, how to remove them? I've added a "tiny" 50x50 size and now my post-thumbnail-meta-box uses it to show the thumbnail. I only could override this by setting default thumbnail again with:
    set_post_thumbnail_size(get_option('thumbnail_size_w'), get_option('thumbnail_size_h'), get_option('thumbnail_crop'));

    Can somebody help me?

  2. José Luís
    Member
    Posted 4 years ago #

    With WordPress 3.0 out, are there any news on this subject?

  3. esmi
    Forum Moderator
    Posted 4 years ago #

    I can't find anything to specifically remove custom images sizes but you could try pulling them out of the $_wp_additional_image_sizes array :

    wp-includes/media.php:

    function add_image_size( $name, $width = 0, $height = 0, $crop = FALSE ) {
    	global $_wp_additional_image_sizes;
    	$_wp_additional_image_sizes[$name] = array( 'width' => absint( $width ), 'height' => absint( $height ), 'crop' => !!$crop );
    }

Topic Closed

This topic has been closed to new replies.

About this Topic