How to insert 4K images in your WordPress posts
( 17 Articles)
After editing your php.ini file (setting upload_max_filesize = 100M or another big number), you can upload big images but still can not insert them into your posts.
Even if you select Full Size from the image size option on the right sidebar of your Gutenberg editor, it seems not working.
For example, you try to embed a 4K image (3840 x 2160) to your post but it automatically scales to 2560 x 1440 (sorry, I don’t remember exactly the height, but the width is absolutely 2560). This is not an error but a feature of WordPress that intends to help speed up your site. However, sometimes we don’t need this feature, i.e. when we have a wallpaper’s website.
Just add the code below somewhere in your theme functions.php:
You might need to go to Settings > Media and update Max Width and Max Height of Large size to very big numbers or zero (no limited):
Save your changes, reload your site and try adding a big photo into your post to make sure it works as expected.
- WordPress: Passing Params to get_template_part()
- Using Docker Compose to speed up WordPress development
- WordPress: Show related posts by tags
- Popular websites built with WordPress
I have made every effort to ensure that every piece of code in this article works properly, but I may have made some mistakes or omissions. If so, please send me an email: [email protected] or leave a comment to report errors.