Unable to change display size of images larger than 640px in Wordpress? Unable to change display size of images larger than 640px in Wordpress? wordpress wordpress

Unable to change display size of images larger than 640px in Wordpress?


Most themes (esp. themes from wordpress) have a specific width limit (measured in pixels) for images inserted in a post or a page. Obviously, that limit depends on the theme’s main column width (which varies greatly from theme to theme).

/wp-includes/media.php has:

// we're inserting a full size image into the editor.  if it's a really big image we'll scale it down to fit reasonably                // within the editor itself, and within the theme's content width if it's known.  the user can resize it in the editor                // if they wish.                if ( !empty($GLOBALS['content_width']) ) {                        $max_width = $GLOBALS['content_width'];                }                else                        <strong>$max_width = 500;</strong>

Try overriding with $GLOBALS['content_width'] = 960; in the theme's function.php


As @Debajyoti Das explains, there is a set content width for most themes.

Either find the width in your theme and amend (search the files for 640) or if you have a child theme then add the following code in your functions.php which will usually override the themes width settings.

For instance this works with the Understrap framework:

// set theme widthglobal $content_width;$content_width = 1024;