Skip to content

Correctly render the list block for the excerpt#3710

Closed
t-hamano wants to merge 4 commits intoWordPress:trunkfrom
t-hamano:57235-excerpt-remove-blocks
Closed

Correctly render the list block for the excerpt#3710
t-hamano wants to merge 4 commits intoWordPress:trunkfrom
t-hamano:57235-excerpt-remove-blocks

Conversation

@t-hamano
Copy link
Copy Markdown
Contributor

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.

'core/heading',
'core/html',
'core/list',
'core/list-item',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

@t-hamano t-hamano Dec 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@t-hamano t-hamano closed this by deleting the head repository Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants