Created
April 13, 2014 18:56
-
-
Save Neolot/10597184 to your computer and use it in GitHub Desktop.
WORDPRESS Remove standard image sizes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Remove standard image sizes so that these sizes are not | |
* created during the Media Upload process | |
* | |
* Tested with WP 3.2.1 | |
* | |
* 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'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment