WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 2 down vote accepted

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)

share|improve this answer
That did it, thanks! – Staffan Estberg Sep 11 '12 at 8:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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