Instantly share code, notes, and snippets.

Embed
What would you like to do?
WP Remove default image sizes
<?php
/**
* Remove standard image sizes so that these sizes are not
* created during the Media Upload process.
* Note: these sizes will appear "disabled" in the Media Uploader
*
* Hooked to intermediate_image_sizes_advanced filter
* See wp_generate_attachment_metadata( $attachment_id, $file ) in wp-admin/includes/image.php
*
* @param $sizes, array of default and added image sizes
* @return $sizes, modified array of image sizes
* @author Ade Walker http://www.studiograsshopper.ch
*/
function sgr_filter_image_sizes( $sizes) {
unset( $sizes['thumbnail']);
unset( $sizes['medium']);
unset( $sizes['large']);
return $sizes;
}
add_filter('intermediate_image_sizes_advanced', 'sgr_filter_image_sizes');
@studiograsshopper

This comment has been minimized.

Owner

studiograsshopper commented Oct 10, 2011

Tested on WP 3.2.1
Tested on WP 3.3 pre-beta 2011/10/06

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment