Make WordPress Core


Ignore:
Timestamp:
10/04/2017 02:58:07 PM (7 years ago)
Author:
joemcgill
Message:

Customizer: Minimize duplicate header crops in the media library.

This adds Custom_Image_Header::get_previous_crop(), which finds any
previously cropped headers created from the same base image and replaces
that attachment rather than creating a new attachment.

After updating a crop, the replaced images is also removed from the list
of previous header images in the Customizer.

See #21819.

File:
1 edited

Legend:

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

    r41673 r41732  
    12151215        $header_images[$header_index]['thumbnail_url'] = $url;
    12161216        $header_images[$header_index]['alt_text'] = get_post_meta( $header->ID, '_wp_attachment_image_alt', true );
     1217        $header_images[$header_index]['attachment_parent'] = (int) get_post_meta( $header->ID, '_wp_attachment_parent', true );
    12171218
    12181219        if ( isset( $header_data['width'] ) )
Note: See TracChangeset for help on using the changeset viewer.