1

I have put add_image_size('image_horizontal', 750, 300, false); in functions.php file but it doesn't appear as selection when publishing new post and adding image in the post, all I see is thumbnail, large and full size. I don't want to change default image sizes, just add this one with others. I did regenerate thumbnails using a plugin after. Does putting a custom image size in selection needs different code?

1
  • New image sizes are not available for images that were uploaded before the new size was added. And what hook do you use to add the image size? It should be after_setup_theme.
    – cjbj
    Commented Jun 3, 2016 at 11:16

1 Answer 1

2

You also need to add it to image size chooser.You can do so using the filter image_size_names_choose.

add_filter( 'image_size_names_choose', 'wpse_228675_custom_size' );

function wpse_228675_custom_size( $sizes ) {
    return array_merge( $sizes, array(
        'image_horizontal' => __('Custom image size'),
    ) );
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.