Skip to content

Instantly share code, notes, and snippets.

@michaeloeser
Created February 14, 2013 14:14
Show Gist options
  • Save michaeloeser/4953085 to your computer and use it in GitHub Desktop.
Save michaeloeser/4953085 to your computer and use it in GitHub Desktop.
Add Custom Image Sizes Into WordPress Media Library
<?php
function display_custom_image_sizes( $sizes ) {
global $_wp_additional_image_sizes;
if ( empty($_wp_additional_image_sizes) )
return $sizes;
foreach ( $_wp_additional_image_sizes as $id => $data ) {
if ( !isset($sizes[$id]) )
$sizes[$id] = ucfirst( str_replace( '-', ' ', $id ) );
}
return $sizes;
}
add_filter( 'image_size_names_choose', 'display_custom_image_sizes' );
@michaeloeser
Copy link
Author

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