Latest posts: Render blocks in full content#76000
Draft
Conversation
When the option to display the full post content is enabled, use the_content filter to render nested blocks and styles. Add a check for the post id, to prevent infinite loops if the post content contains the latest posts block. Display the "rendering halted" message if debug is enabled.
Contributor
Author
|
Flaky tests detected in 7aaece1. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/23186299287
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Closes #69427, #70546
This PR intends to resolve the issue with the block markup being printed on the front, and the missing styles, when the latest posts block is set to display the full post content.
How?
When the option to display the full post content is enabled, use the_content filter to render nested blocks and styles.
Also add a check for the post id, to prevent infinite loops if the post content contains the latest posts block, and prints a "rendering halted" message on the front if debug is enabled.
Using
do_blocks()here would also work. I have no strong preference for either, I usedthe_contentbecause it has been requested by extenders in #70546.This is basically a copy of what is already used in the post content block, template parts, and patterns
https://github.com/WordPress/gutenberg/blob/trunk/packages/block-library/src/post-content/index.php#L27
Testing Instructions
[block rendering halted]AI assistance: Yes
Tool(s): GitHub Copilot
I told Copilot where to look, it wrote the code and then we discussed the pros and cons of do_blocks() vs the_content().