Make WordPress Core


Ignore:
Timestamp:
07/08/2021 05:27:27 PM (3 years ago)
Author:
jorbin
Message:

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.

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.

Backports [51348], [51375], [51378], and [51379] to the 5.8 branch.

Fixes #53604.
Props aristath, jorbin, SergeyBiryukov, desrosj.
Unprops jorbin.

Location:
branches/5.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.8

  • branches/5.8/src/wp-includes/deprecated.php

    r50810 r51382  
    42084208    wp_strict_cross_origin_referrer();
    42094209}
     4210
     4211/**
     4212 * Render inner blocks from the `core/columns` block for generating an excerpt.
     4213 *
     4214 * @since 5.2.0
     4215 * @deprecated 5.8.0
     4216 *
     4217 * @access private
     4218 *
     4219 * @param array $columns        The parsed columns block.
     4220 * @param array $allowed_blocks The list of allowed inner blocks.
     4221 * @return string The rendered inner blocks.
     4222 */
     4223function _excerpt_render_inner_columns_blocks( $columns, $allowed_blocks ) {
     4224    _deprecated_function( __FUNCTION__, '5.8.0', '_excerpt_render_inner_blocks()' );
     4225    return _excerpt_render_inner_blocks( $columns, $allowed_blocks );
     4226}
Note: See TracChangeset for help on using the changeset viewer.