megclaypool
7/30/2018 - 5:07 AM

Add custom WP image sizes to Media Gallery Settings

[Add custom WP image sizes to Media Gallery Settings]

This allows you to use your custom image sizes in the media galleries. Add it to one of the functions.php type files (I put it in the register_image_sizes.php file)

function dl_custom_image_sizes_add_settings($sizes) {
       //unset( $sizes['thumbnail']); //uncomment to remove size if needed
       //unset( $sizes['medium']);// uncomment to remove size if needed
       //unset( $sizes['large']);// uncomment to restore size if needed
       //unset( $sizes['full'] ); // uncomment to remove size if needed
       $mynewimgsizes = array(
              "your-custom-size_name-1" => __( "Name_to_display1" ),
              "your-custom-size_name-2" => __( "Name_to_display2" ),
              "your-custom-size_name-3" => __( "Name_to_display3" )
       );
       $newimgsizes = array_merge($sizes, $mynewimgsizes);
       return $newimgsizes;
}
add_filter('image_size_names_choose', 'dl_custom_image_sizes_add_settings');