Why is wp_get_attachment_image_src returning wrong dimensions? [duplicate]

I found the same issue here
and the solution from there works.

The solution is as simple as pasting this:

$content_width = 2000;// Value higher than your new 'large' width

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.

Check the link above to refer to his full answer.


This is a link to the underscores theme project, where they set this value.

Leave a Comment

tech