Support » Fixing WordPress » For add_image_size can’t get bigger images then one particular size

  • Resolved Gints



    I added some custom image sizes, added them to be selectable from your WordPress admin, but I can’t select higher then 625px wide images. All my definition higher then that is literally ignored and can’t use these image in theme and choose using WP admin. But I can see these sizes are cropped thought the FTP.

    This is my code for the functions.php:

    // Add image sizes
       add_image_size( 'custom-half-width', 410, 9999 );
       add_image_size( 'custom-medium-full-width', 830, 9999 );
       add_image_size( 'custom-large-full-width', 1180, 9999 );
    // Register the three useful image sizes for use in Add Media modal
    add_filter( 'image_size_names_choose', 'my_custom_sizes' );
    function my_custom_sizes( $sizes ) {
        return array_merge( $sizes, array(
            'custom-half-width' => __( 'custom-half-width' ),
            'custom-medium-full-width' => __( 'custom-medium-full-width' ),
            'custom-large-full-width' => __( 'custom-large-full-width' ),
        ) );

    And this is what I can choose when adding the media:

    In the same time, I even can’t define in default WP images higher sizes then 625px wide as all of that size is ignored, as you can see for Large image I can choose 625px wide even I have 1024px defined in my WP Media settings.

    Any suggestions what I can check or do to figure out why I can’t choose bigger images then 625px wide?

    Huge thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator Steven Stern (sterndata)


    Forum Moderator & Support Team Volunteer

    Have you tested this on an image that’s over 1180px wide on upload? And have you rebuilt your thumbnails since adding the image sizes?

    Thanks @sterndata

    Yes, I regenerated thumbnails with this plugin:

    The tests were made even with bigger images over 3000px wide and still nothing.

    The screenshot is from the image with 1920x770px size.

    And the same issue is with freshly uploaded images as well, not only with old ones after regenerating thumbnails.

    And another interesting thing, that I can choose original Full Size, but nothing between Full size and 625px wide.


    And here is an update how it looks like if I embedding the image in a post:
    <img class="alignnone size-custom-medium-full-width wp-image-34638" src="" alt="" width="625" height="287">

    As you can see, the image is cropped and the right version of the image is chosen, but width=”625″ height=”287 is max 625px for all images.

    If I choose any image version under 625px width it works properly.

    And the same changing default Twenteen Seventeen theme:
    <img class="alignnone size-custom-medium-full-width wp-image-34638" src="" alt="" width="625" height="287" srcset=" 830w, 300w, 768w, 625w, 410w, 1180w" sizes="(max-width: 625px) 100vw, 625px">

    But here: sizes=”(max-width: 625px) 100vw, 625px always is max 625px.

    • This reply was modified 2 years, 1 month ago by Gints.
    • This reply was modified 2 years, 1 month ago by Gints.
    Moderator Steven Stern (sterndata)


    Forum Moderator & Support Team Volunteer

    Just a note to let you know I read your post. In the morning, after some coffee, I’ll copy your code onto my test site and play around and if I can figure it out.

    Thanks @sterndata

    I just tested the same code on another WP instal on the same server and it works.

    The issue is only with one WP. that website has a big history, but the issue is even I switch off all plugins and using Twenteen Seventeen default theme. But for the Twenteen Seventeen, the limit now is 525px max. For that theme, I can’t get higher pictures then 525px. It looks like that for some reason the website is respecting content width and use that as for the max number for images. Totally strange.

    I moved that website recently to test server as a need to do updates, but it was migrated on fresh WordPress install and I copied only files into wp-content folder and database.

    The same issue is on the live server website.

    Any hint where can look for something that still could affect website if all plugins are deactivated and are using default theme? Any tips how can troubleshooting this, as I need to find the issue source. Maybe something in a database could affect this?

    Actually, I think that I dug the issue where there is no issue.
    It’s how WP works and it doesn’t allow to choose wider images as the content is.



    This is fully fixed now and here is a summary of the issue:
    It looks like that the theme developer set content width 625px even the wider screens were available to get the content up to 825px wide and this didn’t allow to add wider images in content then 625px.

    Adding this code in a child theme functions.php file which overwrites default theme content width limitation:

    if ( ! isset( $content_width ) ) {
    	$content_width = 825;

    More info in official WordPress documentation here:

    • This reply was modified 2 years ago by Gints.
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘For add_image_size can’t get bigger images then one particular size’ is closed to new replies.