Menü schliessen
Created: December 3rd 2020
Last updated: December 3rd 2020
Categories: IT Development,  Wordpress
Author: Marcus Fleuti

Wordpress: Images are getting scaled automatically

Tags:  5.3,  feature,  Image,  pixel,  scaling,  threshold,  wordpress
Donation Section: Background
Monero Badge: QR-Code
Monero Badge: Logo Icon Donate with Monero Badge: Logo Text
82uymVXLkvVbB4c4JpTd1tYm1yj1cKPKR2wqmw3XF8YXKTmY7JrTriP4pVwp2EJYBnCFdXhLq4zfFA6ic7VAWCFX5wfQbCC

Information

With the version 5.3 of WordPress, they've added a feature that forces large images to scale down in size, so they are web-ready. If an image is larger as the declared size it's going to get scaled automatically.

Disable big_image_size_threshold

If you want to disable this new feature, you just have to simply add this line of code to the functions.php file.

add_filter( 'big_image_size_threshold', '__return_false' );

Enable big_image_size_threshold

If you want to enable the scaling by yourself, you can set the threshold in pixels for the image. Everything is getting declared in the functions.php function.

mynamespace_big_image_size_threshold($threshold) {
     return 4000; 
}
add_filter('big_image_size_threshold','mynamespace_big_image_size_threshold', 999, 1);