• Greetings.

    I implemented the “big_image_size_threshold” WordPress filter hook on a new theme in development. There are no plugins installed that override this filter hook. I noticed it works only when defining a callback function that returns the desired threshold image size – in this case, the width target. It does not work when returning ‘__return_false’, which is suppose to disable the image size threshold altogether.

    // completely disable image size threshold
    // add_filter( 'big_image_size_threshold', '__return_false' );
    
    // increase the image size threshold to 4000px
    function lit_big_image_size_threshold( $threshold ) {
        return 10000; // new threshold
    }
    add_filter('big_image_size_threshold', 'lit_big_image_size_threshold', 999, 1);?>

    I confirmed this by deleting the image in question from the WordPress Media Library prior to testing with each version of the filter hook. The disabling non-working version results in a large format image, the one originally imported into the WP Media Library, begin replaced with a scaled version at the default 2560px width size.

    This scaled default behavior does not occur when applying the filter hook callback function version, again, which I verified in the WP Media Library. With the originally imported image falling below the threshold set in the filter hook’s callback function, the WP Media Library contains the imported image file in its original size.

    Your feedback is greatly appreciated. Thank you.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘“big_image_size_threshold” Partially Works’ is closed to new replies.