Make WordPress Core


Ignore:
Timestamp:
07/07/2021 07:09:41 PM (3 years ago)
Author:
desrosj
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks.php

    r51362 r51375  
    717717    );
    718718
     719    /**
     720     * Filters the list of blocks that can be used as wrapper blocks, allowing
     721     * excerpts to be generated from the `innerBlocks` of these warppers.
     722     *
     723     * @since 5.8.0
     724     *
     725     * @param array $allowed_wrapper_blocks The list of allowed wrapper blocks.
     726     */
     727    $allowed_wrapper_blocks = apply_filters( 'excerpt_allowed_wrapper_blocks', $allowed_wrapper_blocks );
     728
    719729    $allowed_blocks = array_merge( $allowed_inner_blocks, $allowed_wrapper_blocks );
    720730
Note: See TracChangeset for help on using the changeset viewer.