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:

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

PS: we'll drop lifetime pricing from Dec 01, 2024. Get it now before it's gone!

Leave a Reply

Your email address will not be published. Required fields are marked *


Copyright © 2024 Deluxe Blog Tips. All rights reserved.

My products: Meta Box | Slim SEO