Correctly render the list block for the excerpt#3710
Correctly render the list block for the excerpt#3710t-hamano wants to merge 4 commits intoWordPress:trunkfrom
Conversation
src/wp-includes/blocks.php
Outdated
| 'core/heading', | ||
| 'core/html', | ||
| 'core/list', | ||
| 'core/list-item', |
There was a problem hiding this comment.
Should we move core/list to allowed_wrapper_blocks? 🤔 Also I guess we have the same issue for core/quote as it changed to support innerBlocks and we should move this to allowed_wrapper_blocks as well.
There was a problem hiding this comment.
I have thought about this issue again and it may be more complicated than I imagined.
If allowed by allowed_wrapper_blocks, the wrapper block will be removed and only the innerBlocks will be rendered. That is, the ul/ol element is removed and only the li elements are rendered.
Rendering only inner blocks is the expected behavior for columns/column/group block. However, for the list block only, the wrapper block must also be rendered.
So I left the allowed list as is and added here a special condition for the list block. There may be other more ideal approaches.
Trac ticket: https://core.trac.wordpress.org/ticket/57235
Related gutenberg issue: WordPress/gutenberg#46167
This PR fixes a problem with the unintentional removal of the list block in the output of excerpts. This appears to be due to the change of list items to blocks in WordPress 6.1.
At the same time, I added the list block markup in the unit test for
excerpt_remove_blocks.This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.