I am trying to return the src, width and height of a cetain image:

$img = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');

This is returning the expected array but with incorrect width and height values

$img[0] -> .../wp-content/uploads/2014/11/image-2000x1125.jpg
$img[1] -> 640
$img[2] -> 360

The image is actually 2000x1125 but the width and height returned are incorrect. I have tried regenerating sizes with several plugins with no luck. This issue happens only with 'large' size.

Could this be a bug? Is there some other way of returning image sizes (hopefully correct)?

  • If you want to return the original uploaded file, use full instead of large
    – SLH
    Commented Nov 5, 2014 at 17:19
  • I want to retrieve each of the available sizes. And I already have achieved, but have a bug with large size only, in all images Ive tried so far (640 as width and different height, always incorrect)
    – Alvaro
    Commented Nov 5, 2014 at 17:29
  • Did you changed sizes in Settings -> Media?
    – SLH
    Commented Nov 5, 2014 at 17:34
  • 1
    I changed long time ago, if I upload a new image right now, it keeps returning 640..
    – Alvaro
    Commented Nov 5, 2014 at 17:41

1 Answer 1


I found the same issue here and the solution from there works: Settings in 'Media > Settings' is ignored when inserting images

The solution is as simple as paste this:

$content_width = 2000;// The value I want

in functions.php

Explanation copied from there(user Chip Bennett):

I believe your issue is that the value set for the global $content_width variable (which is 640px in Boilerplate and 584px in Twenty Eleven) is less than the width you're specifying via Settings -> Media.

WordPress is overriding your user setting with the Theme-specific value. This actually makes sense, since a Theme knows its maximum content width, and using a larger image width than what the Theme is designed to accommodate would very likely break the Theme layout.

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