WordPress.org

Make WordPress Core

Changeset 48152


Ignore:
Timestamp:
06/23/2020 11:32:14 PM (5 months ago)
Author:
whyisjake
Message:

Cache API: Cache the results of get_uploaded_header_images().

Fixes #49446.

Props pbiron, SergeyBiryukov, desrosj.

File:
1 edited

Legend:

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

    r48126 r48152  
    22012201 */
    22022202function _media_states( $post ) {
     2203    static $header_images;
     2204
    22032205    $media_states = array();
    22042206    $stylesheet   = get_option( 'stylesheet' );
     
    22082210
    22092211        if ( is_random_header_image() ) {
    2210             $header_images = wp_list_pluck( get_uploaded_header_images(), 'attachment_id' );
     2212            if ( ! isset( $header_images ) ) {
     2213                $header_images = wp_list_pluck( get_uploaded_header_images(), 'attachment_id' );
     2214            }
    22112215
    22122216            if ( $meta_header === $stylesheet && in_array( $post->ID, $header_images, true ) ) {
Note: See TracChangeset for help on using the changeset viewer.