Site logo

[Resolved] New image sizes not shown in standard wp image block

Home Forums Support [Resolved] New image sizes not shown in standard wp image block

Home Forums Support New image sizes not shown in standard wp image block

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1876587
    nomadiceman

    I’ve added the below new size:

    add_action( 'init', function() {
        add_image_size( 'new-featured-image', 800, 600, true ); // 800 width, 600 height, crop
    
    } );

    I can select these size in the customiser for the featured image, but it does not show in the standard WordPress image block

    The options showing in the WordPress image block in a post is the stand small, medium, large

    Any ideas how I can get the new size options in the image block?

    * I have regenerated all sizes fyi

    #1876617
    Elvin
    Staff
    Customer Support

    Hi there,

    Can you try disabling ALL plugins and see if it appears? Some plugins (usually image optimization plugins) are known to mess with this. It’s worth a try.

    If it doesn’t can you try temporarily changing to a default WordPress theme and check again?

    Let us know.

    #1876738
    nomadiceman

    Hi,

    Ok so I’ve just disabled all plugins, the issue was still there

    I then switched to Twenty Twenty One theme and that also didn’t fix the problem

    The new size is not showing in the standard WordPress image block

    Any ideas?

    #1877078
    David
    Staff
    Customer Support

    Hi there,

    the Image size will only display the sizes available for the image you selected.
    If you added the code after images were uploaded you will need to run the Regenerate Thumbnails plugin to create your new custom size.

    You can quickly test this by uploading a new image, as WP will automatically create the sizes for new images.

    If theres still an issue, then clear any plugin / browser caches

    #1877754
    nomadiceman

    Hi guys,

    I did the regenerate again to make sure.

    I’ve got all plugins off. No caching. Twenty twenty theme

    And still no image size option in standard image box

    Im using wp 5.8

    Any ideas? Driving me crazy 😜

    #1877785
    nomadiceman

    I’m not a coder do I do struggle with it

    I’ve seen this post and it seems I need to add extra code. Additional to the ones you suggest

    https://wpmudev.com/blog/wordpress-image-sizes/

    What do you think?

    This part they say is needed for it to show in the image drop down

    <?php
    
    add_filter( 'image_size_names_choose','wpmudev_custom_image_sizes' );
    
    function wpmudev_custom_image_sizes( $sizes ) {
    return array_merge( $sizes, array(
    
    //Add your custom sizes here
    'custom-image-square' => __( 'Square' ),
    'blog-width' => __( 'Blog Content Full Width' ),
    ) );
    }

    What do you suggest?

    Thanks again for you help 🙏

    #1877794
    Leo
    Staff
    Customer Support

    I would say go ahead and try the code and see if it works for you.

    If not then you can mention this to WP’s support team and see if they have a suggestion.

    GP cannot control the standard image block from WP.

    #1877796
    nomadiceman

    yeah ill give it a try

    I was hoping this issue may have arisen before and been resolved already haha

    #1877798
    Leo
    Staff
    Customer Support

    Sounds good 🙂

    #1877816
    nomadiceman

    Oh, I’ve figured it out.

    I just added the part of the code from wpdev site that shows the options in the drop down.

    and change the name of the images to what I use:

    <?php
    
    add_filter( 'image_size_names_choose','wpmudev_custom_image_sizes' );
    
    function wpmudev_custom_image_sizes( $sizes ) {
    return array_merge( $sizes, array(
    
    //Add your custom sizes here
    'custom-image-square' => __( 'Square' ),
    'blog-width' => __( 'Blog Content Full Width' ),
    ) );
    }

    now the sizes show in the gutenberg image block

    🙂

    #1877947
    Leo
    Staff
    Customer Support

    Thanks for sharing your solution!

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.