Posts: Allow the list of wrapper blocks to be filtered.

This introduces the `excerpt_allowed_wrapper_blocks` filter for controlling which blocks should be considered wrapper blocks.

Wrapper blocks and their nested contents are not stripped by `excerpt_remove_blocks()`, allowing their contents to appear in generated excerpts.

Follow up to [51348].

Props aristath, jorbin.
See #53604.
Built from https://develop.svn.wordpress.org/trunk@51375


git-svn-id: http://core.svn.wordpress.org/trunk@50986 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
desrosj 2021-07-07 19:10:57 +00:00
parent b16abdec23
commit 501e37bf2b
2 changed files with 11 additions and 1 deletions

View File

@ -716,6 +716,16 @@ function excerpt_remove_blocks( $content ) {
'core/group',
);
/**
* Filters the list of blocks that can be used as wrapper blocks, allowing
* excerpts to be generated from the `innerBlocks` of these warppers.
*
* @since 5.8.0
*
* @param array $allowed_wrapper_blocks The list of allowed wrapper blocks.
*/
$allowed_wrapper_blocks = apply_filters( 'excerpt_allowed_wrapper_blocks', $allowed_wrapper_blocks );
$allowed_blocks = array_merge( $allowed_inner_blocks, $allowed_wrapper_blocks );
/**

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.9-alpha-51372';
$wp_version = '5.9-alpha-51375';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.