WordPress.org

Make WordPress Core

Changeset 45645


Ignore:
Timestamp:
07/16/2019 09:47:35 PM (5 months ago)
Author:
azaozz
Message:

Media: Sort the new sizes array by priority when creating image sub-sizes.

See #40439.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/image.php

    r45611 r45645  
    228228
    229229    if ( ! empty( $new_sizes ) ) {
     230        // Sort the image sub-sizes in order of priority when creating them.
     231        // This ensures there is an appropriate sub-size the user can access immediately
     232        // even when there was an error and not all sub-sizes were created.
     233        $priority = array(
     234            'medium'       => null,
     235            'large'        => null,
     236            'thumbnail'    => null,
     237            'medium_large' => null,
     238        );
     239
     240        $new_sizes = array_filter( array_merge( $priority, $new_sizes ) );
     241
    230242        $editor = wp_get_image_editor( $file );
    231243
Note: See TracChangeset for help on using the changeset viewer.