Skip to content

Instantly share code, notes, and snippets.

@jpmarchand
Last active September 27, 2016 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpmarchand/8f44cb7b1307f524d406 to your computer and use it in GitHub Desktop.
Save jpmarchand/8f44cb7b1307f524d406 to your computer and use it in GitHub Desktop.
Remove image sizes in WordPress. Source: http://www.wpmayor.com/remove-image-sizes-in-wordpress/
<?php
function wpmayor_custom_image_sizes($sizes) {
$myimgsizes = array("image-in-post" => __("Image in Post"), "full" => __("Original size"));
return $myimgsizes;
}
add_filter('image_size_names_choose', 'wpmayor_custom_image_sizes');
<?php
//* Remove image sizes in WordPress
function customprefix_remove_image_sizes($sizes) {
unset($sizes['medium']);
unset($sizes['large']);
unset($sizes['plugin-name-image-size']);
return $sizes;
}
add_filter('intermediate_image_sizes_advanced', 'customprefix_remove_image_sizes');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment