avatar Deluxe Blog Tips About Projects

Change Default Max Image Size For WordPress Theme

In WordPress themes, post content often has specified width. Thus, images which has bigger size than content width can break up the layout of theme. To prevent this situation, WordPress provides one way to specify the maximum image size for themes.

To define the maximum image size, just paste the following line into your functions.php file:

$content_width = 400;

Change 400 to any number (which is the maximum width of images) you want.

After that, when you upload any image when posting, you'll see the maximum image width is set to 400px as in the following screenshot:

Change Default Max Image Size For WordPress Theme

This setting will overwrite the settings in the Settings → Media menu.

🔥 HOT: Interested in boosting your WordPress SEO? My Slim SEO plugin is a super lighweight and automated plugin that handles most the hard work for you: meta tags, sitemap, redirection, schema & link building.

👉 Have a look and you will love it: wpslimseo.com

Comments