block_core_post_template_uses_featured_image

The timeline below displays how wordpress function block_core_post_template_uses_featured_image has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Server-side rendering of the `core/post-template` block.
 *
 * @package WordPress
 */
/**
 * Determines whether a block list contains a block that uses the featured image.
 *
 * @param WP_Block_List $inner_blocks Inner block instance.
 *
 * @return bool Whether the block list contains a block that uses the featured image.
 */
function block_core_post_template_uses_featured_image($inner_blocks)
{
    foreach ($inner_blocks as $block) {
        if ('core/post-featured-image' === $block->name) {
            return true;
        }
        if ('core/cover' === $block->name && !empty($block->attributes['useFeaturedImage'])) {
            return true;
        }
        if ($block->inner_blocks && block_core_post_template_uses_featured_image($block->inner_blocks)) {
            return true;
        }
    }
    return false;
}