Custom image sizes only for ACF

Custom image sizes only for ACF

Approved. Code works!
This is exactly the working code that is verified by the moderator or site administrators
add_filter('intermediate_image_sizes_advanced', 'limit_image_sizes_to_acf', 10, 2);

function limit_image_sizes_to_acf($sizes, $metadata) {
    
    if (isset($_REQUEST['acf_field'])) {
        return $sizes; // 
    }

    
    unset($sizes['150x100']);
    unset($sizes['513x499']);
    unset($sizes['276x268']);
    unset($sizes['26x26']);
    unset($sizes['707x834']);
    unset($sizes['115x116']);
    unset($sizes['176x177']);
    unset($sizes['308x208']);

    return $sizes; 
}
0

More

Leave a Reply

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

How many?: 22 + 22

lil-code© | 2022 - 2024
Go Top
Authorization
*
*
Registration
*
*
*
*
Password generation