A lot of time has passed (and I'm on WordPress 4.7), but I was having the same issue tonight and found a solution. Instead of
add_image_size( 'custom-size', 220, 180, true );
add_filter( 'image_size_names_choose', 'my_custom_sizes' );
function my_custom_sizes( $sizes ) {
return array_merge( $sizes, array(
'custom-size' => __( 'Your Custom Size Name' ),
) );
}
I had to refactor my code to pass my function as the second parameter to add_filter
, like so:
add_image_size( 'custom-size', 220, 180, true );
add_filter( 'image_size_names_choose', function ( $sizes ) {
return array_merge( $sizes, array(
'custom-size' => __( 'Your Custom Size Name' ),
) );
} );
I came up with this solution after right-clicking the empty 'Size' dropdown on the Media select screen and choosing 'Inspect Element', which allowed me to see the error. I'm not sure if changes in WordPress or my host (Site5) caused the issue, but I hope this answer will help someone.