Make WordPress Core


Ignore:
Timestamp:
05/10/2022 04:20:59 PM (3 years ago)
Author:
hellofromTonya
Message:

Editor: Update WordPress packages for 6.0 RC 2.

[53377] Included cherry-picked commits from the Gutenberg plugin that fix bugs discovered after WordPress 6.0 RC 1.

[53378] Includes cherry-picked commit from the Gutenberg plugin that fix a bug discovered just before WordPress 6.0 RC 2.

Props zieladam, ndiego, kebbet, hellofromTonya.
Merges [53377] and [53378] to the 6.0 branch.
Fixes #55567.

Location:
branches/6.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.0

  • branches/6.0/src/wp-includes/blocks/post-template.php

    r53157 r53381  
    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.