Removing default media image sizes in WordPress
After uploading any image to WordPress by default it generate 3 default size of the image
- Thumbnail
- Medium Size
- Large Size
/** * Removes the default wordpress image styles * this prevents wordpress to generate other size of image for uploaded image * * 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 Pawan Kumar http://www.w3-learn.com */ function w3learn_filter_image_sizes( $sizes) { unset( $sizes['thumbnail']); unset( $sizes['medium']); unset( $sizes['large']); return $sizes; } add_filter('intermediate_image_sizes_advanced', 'w3learn_filter_image_sizes');