0

I have removed unnecessary default image sizes in WordPress:

function my_remove_default_image_sizes( $sizes ) {
    unset( $sizes[ 'medium' ] );
    unset( $sizes[ 'large' ] );

    return $sizes;
}

add_filter( 'intermediate_image_sizes_advanced', 'my_remove_default_image_sizes' );

However when going to Settings > Media the options are still listed:

WordPress Media Settings

Is there a way for to remove Medium size and Large size form from this page?

2

Note: you shouldn't remove any of the default images since they're all highly used throughout the WordPress admin. For example, on the media library page all those image blocks are technically "medium" sized images scaled down. If you click an image it will display the "large" image if possible. Otherwise, these default to show a scaled down "Full" image which can really slow down the media library and the process of choosing / editing images in the post editor.

TL;DR Removing default image sizes could have adverse effects and slow down certain areas.


WordPress makes these static so there's no easy way to actually remove these fields, they're hardcoded into the table. The next best thing we can do is hide them using CSS which I'll show below. The following code can be placed in a functions.php file:

/**
 * Custom Admin Styles
 *
 * @return void
 */
function wpse279908_admin_print_styles() {

    $screen = get_current_screen();

    // Media Options Page Only
    if( 'options-media' !== $screen->id ) {
        return;
    }

  ?>

    <style>
        #wpbody-content form > table:first-of-type tr:nth-of-type( 2 ),
        #wpbody-content form > table:first-of-type tr:nth-of-type( 3 )  {display: none;}
    </style>

  <?php

}
add_action( 'admin_print_styles', 'wpse279908_admin_print_styles' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.