excerpt_allowed_blocks
Filters the list of blocks that can contribute to the excerpt.
If a dynamic block is added to this list, it must not generate another excerpt, as this will cause an infinite loop to occur.
Usage
add_filter( 'excerpt_allowed_blocks', 'wp_kama_excerpt_allowed_blocks_filter' );
/**
* Function for `excerpt_allowed_blocks` filter-hook.
*
* @param string[] $allowed_blocks The list of names of allowed blocks.
*
* @return string[]
*/
function wp_kama_excerpt_allowed_blocks_filter( $allowed_blocks ){
// filter...
return $allowed_blocks;
}
- $allowed_blocks(string[])
- The list of names of allowed blocks.
Changelog
| Since 5.0.0 | Introduced. |
Where the hook is called
excerpt_allowed_blocks
wp-includes/blocks.php 2181
$allowed_blocks = apply_filters( 'excerpt_allowed_blocks', $allowed_blocks );