Skip to main content
deleted 26 characters in body
Source Link
Sam
  • 138
  • 7

Try this

function filter_image_sizes() {
    foreach ( get_intermediate_image_sizes() as $size ) {
        if (in_array( $size, array('medium', 'medium_large', 'large', '1536x1536', '2048x2048') ) ) {
            remove_image_size( $size );
        }
    }
}

add_action('init', 'filter_image_sizes');

Try this

function filter_image_sizes() {
    foreach ( get_intermediate_image_sizes() as $size ) {
        if (in_array( $size, array('medium', 'medium_large', 'large', '1536x1536', '2048x2048') ) ) {
            remove_image_size( $size );
        }
    }
}

add_action('init', 'filter_image_sizes');

Try this

function filter_image_sizes() {
    foreach ( get_intermediate_image_sizes() as $size ) {
        if (in_array( $size, array('medium', 'medium_large', 'large') ) ) {
            remove_image_size( $size );
        }
    }
}

add_action('init', 'filter_image_sizes');
deleted 2 characters in body
Source Link
Sam
  • 138
  • 7

Try this

function filter_image_sizes() {
    foreach ( get_intermediate_image_sizes() as $size ) {
        if ( !in_array( $size, array('medium', 'medium_large', 'large', '1536x1536', '2048x2048') ) ) {
            remove_image_size( $size );
        }
    }
}

add_action('init', 'filter_image_sizes');

Try this

function filter_image_sizes() {
    foreach ( get_intermediate_image_sizes() as $size ) {
        if ( !in_array( $size, array('medium', 'medium_large', 'large', '1536x1536', '2048x2048') ) ) {
            remove_image_size( $size );
        }
    }
}

add_action('init', 'filter_image_sizes');

Try this

function filter_image_sizes() {
    foreach ( get_intermediate_image_sizes() as $size ) {
        if (in_array( $size, array('medium', 'medium_large', 'large', '1536x1536', '2048x2048') ) ) {
            remove_image_size( $size );
        }
    }
}

add_action('init', 'filter_image_sizes');
Source Link
Sam
  • 138
  • 7

Try this

function filter_image_sizes() {
    foreach ( get_intermediate_image_sizes() as $size ) {
        if ( !in_array( $size, array('medium', 'medium_large', 'large', '1536x1536', '2048x2048') ) ) {
            remove_image_size( $size );
        }
    }
}

add_action('init', 'filter_image_sizes');