WordPress.org

Make WordPress Core

Ticket #49446: 49446.2.diff

File 49446.2.diff, 1.0 KB (added by SergeyBiryukov, 3 months ago)
  • src/wp-admin/includes/template.php

     
    22002200 *
    22012201 * @since 3.2.0
    22022202 *
     2203 * @staticvar int[] $header_images
     2204 *
    22032205 * @param WP_Post $post The attachment post to retrieve states for.
    22042206 * @return string Media states string.
    22052207 */
    22062208function _media_states( $post ) {
     2209        static $header_images;
     2210
    22072211        $media_states = array();
    22082212        $stylesheet   = get_option( 'stylesheet' );
    22092213
     
    22112215                $meta_header = get_post_meta( $post->ID, '_wp_attachment_is_custom_header', true );
    22122216
    22132217                if ( is_random_header_image() ) {
    2214                         $header_images = wp_list_pluck( get_uploaded_header_images(), 'attachment_id' );
     2218                        if ( ! isset( $header_images ) ) {
     2219                                $header_images = wp_list_pluck( get_uploaded_header_images(), 'attachment_id' );
     2220                        }
    22152221
    22162222                        if ( $meta_header === $stylesheet && in_array( $post->ID, $header_images, true ) ) {
    22172223                                $media_states[] = __( 'Header Image' );