WordPress.org

Make WordPress Core

Opened 8 weeks ago

Last modified 8 weeks ago

#46133 assigned defect (bug)

Parse blocks to generate the excerpt

Reported by: gziolo Owned by: pento
Milestone: 5.2 Priority: normal
Severity: normal Version: 5.0
Component: General Keywords: needs-patch needs-unit-tests
Focuses: Cc:

Description

Moved from GitHub: https://github.com/WordPress/gutenberg/pull/11704

Originally authored by @pento:

Now that https://github.com/WordPress/gutenberg/pull/11141 has landed, we can use the same logic when generating an excerpt, which allows us to deprecate get_dynamic_blocks_regex().

By using a list of allowed blocks, we can avoid the other issue that strip_dynamic_blocks() is intended to address, when a dynamic block can call get_the_excerpt(), causing an infinite loop.

Out of interest, https://github.com/WordPress/gutenberg/commit/198c82f0323a433eaea33f63a3fb94866be5ba32 is an alternate method, which just tweaks strip_dynamic_blocks() to use the parser, but I think this is the better method.

It should be recreated in core based on the referenced Pull Request.

Change History (2)

#1 @gziolo
8 weeks ago

  • Owner set to pento
  • Status changed from new to assigned

This comment from GitHub seems to be important:

Core uses the same code as in this PR, so both Gutenberg and core are currently wrong, in their own special way. 🙂

I think we can just implement something like https://github.com/WordPress/gutenberg/pull/10108, and modify this change to use that new filter. This can be done in core, we don't need to bother in Gutenberg.

#2 @pento
8 weeks ago

  • Keywords needs-patch needs-unit-tests added
  • Milestone changed from Awaiting Review to 5.2
  • Version set to 5.0
Note: See TracTickets for help on using tickets.