Posts: Prevent an empty excerpt when groups and nested column blocks are present.

This improves the logic within `excerpt_remove_blocks()` to better handle `innerBlocks`. This prevents an empty excerpt from being returned when `core/columns`, `core/column`, and `core/group` blocks are present.

This issue has been surfaced in the Query Loop block, where excerpts can be set to display. 

Props aristath.
Fixes #53604.

git-svn-id: https://develop.svn.wordpress.org/trunk@51348 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jonathan Desrosiers
2021-07-06 15:31:48 +00:00
parent dd332ea876
commit 0690170556
3 changed files with 99 additions and 12 deletions
+17
View File
@@ -4207,3 +4207,20 @@ function wp_sensitive_page_meta() {
<?php
wp_strict_cross_origin_referrer();
}
/**
* Render inner blocks from the `core/columns` block for generating an excerpt.
*
* @since 5.2.0
* @deprecated 5.8.0
*
* @access private
*
* @param array $columns The parsed columns block.
* @param array $allowed_blocks The list of allowed inner blocks.
* @return string The rendered inner blocks.
*/
function _excerpt_render_inner_columns_blocks( $columns, $allowed_blocks ) {
_deprecated_function( __FUNCTION__, '5.8.0', '_excerpt_render_inner_blocks()' );
return _excerpt_render_inner_blocks( $columns, $allowed_blocks );
}