I want to use a couple of custom image sizes for a site that I'm developing. When I output the images I sometimes do not get the correct width size because it is mixed up with the height size. It guess it has something to do with how I declare the image sizes in the functions file.


add_image_size( 'small', 145, 999 );
add_image_size( 'medium', 300, 999 );
add_image_size( 'large', 455, 999 );
add_image_size( 'tablet', 1024, 9999 );

$image = wp_get_attachment_image_src(get_field('custom-field'), 'medium');

gives me

    [0] => http://example.com/wp-content/uploads/2012/09/example-300x399.jpg
    [1] => 225
    [2] => 300
    [3] => 1

Notice the width size is no. 2 in the array, when it usually is 1. Is the output order different if the image is taller then wider? The "errors" that I get are all from vertical images.

1 Answer 1


The "medium" and "large" are not custom image sizes - they are already part of the core WordPress media sizes and they should be handled via the "settings" -> "media" options page in wp-admin.

Give your custom image sizes a different and more unique name (reserved are thumbnail, medium, large, full)


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.