Make WordPress Core


Ignore:
Timestamp:
05/10/2022 02:47:10 PM (2 years ago)
Author:
gziolo
Message:

Editor: Update WordPress packages for 6.0 RC 2

Included cherry-picked commits from the Gutenberg plugin that fix bugs discovere after WordPress 6.0 RC 1.

Props zieladam, ndiego, hellofromtonya.
See #55567.

File:
1 edited

Legend:

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

    r53157 r53377  
    55 * @package WordPress
    66 */
     7
     8/**
     9 * Determines whether a block list contains a block that uses the featured image.
     10 *
     11 * @param WP_Block_List $inner_blocks Inner block instance.
     12 *
     13 * @return bool Whether the block list contains a block that uses the featured image.
     14 */
     15function block_core_post_template_uses_featured_image( $inner_blocks ) {
     16    foreach ( $inner_blocks as $block ) {
     17        if ( 'core/post-featured-image' === $block->name ) {
     18            return true;
     19        }
     20        if (
     21            'core/cover' === $block->name &&
     22            ! empty( $block->attributes['useFeaturedImage'] )
     23        ) {
     24            return true;
     25        }
     26        if ( $block->inner_blocks && block_core_post_template_uses_featured_image( $block->inner_blocks ) ) {
     27            return true;
     28        }
     29    }
     30
     31    return false;
     32}
    733
    834/**
     
    3965    if ( ! $query->have_posts() ) {
    4066        return '';
     67    }
     68
     69    if ( block_core_post_template_uses_featured_image( $block->inner_blocks ) ) {
     70        update_post_thumbnail_cache( $query );
    4171    }
    4272
Note: See TracChangeset for help on using the changeset viewer.