WordPress.org

Make WordPress Core

Ticket #49446: 49446.diff

File 49446.diff, 923 bytes (added by SergeyBiryukov, 4 months ago)
  • src/wp-admin/includes/template.php

     
    21792179 * @return string Media states string.
    21802180 */
    21812181function _media_states( $post ) {
     2182        static $header_images;
     2183
    21822184        $media_states = array();
    21832185        $stylesheet   = get_option( 'stylesheet' );
    21842186
     
    21862188                $meta_header = get_post_meta( $post->ID, '_wp_attachment_is_custom_header', true );
    21872189
    21882190                if ( is_random_header_image() ) {
    2189                         $header_images = wp_list_pluck( get_uploaded_header_images(), 'attachment_id' );
     2191                        if ( ! isset( $header_images ) ) {
     2192                                $header_images = wp_list_pluck( get_uploaded_header_images(), 'attachment_id' );
     2193                        }
    21902194
    21912195                        if ( $meta_header == $stylesheet && in_array( $post->ID, $header_images ) ) {
    21922196                                $media_states[] = __( 'Header Image' );