Changeset 53381 for branches/6.0/src/wp-includes/blocks/post-template.php
- Timestamp:
- 05/10/2022 04:20:59 PM (3 years ago)
- Location:
- branches/6.0
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/6.0
- Property svn:mergeinfo changed
/trunk merged: 53377-53378
- Property svn:mergeinfo changed
-
branches/6.0/src/wp-includes/blocks/post-template.php
r53157 r53381 5 5 * @package WordPress 6 6 */ 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 */ 15 function 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 } 7 33 8 34 /** … … 39 65 if ( ! $query->have_posts() ) { 40 66 return ''; 67 } 68 69 if ( block_core_post_template_uses_featured_image( $block->inner_blocks ) ) { 70 update_post_thumbnail_cache( $query ); 41 71 } 42 72
Note: See TracChangeset
for help on using the changeset viewer.