-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When rendering template parts don't call wpautop() to avoid unwanted empty paragraphs (#26731) #26809
Conversation
This one can be a bit impactful. I'd love for us to "deprecated" autop in FSE templates and template parts but I'm not sure I understand the impact of something like that fully. I'd love thoughts from more folks here. |
Here's the latest example of the problem. |
And another.... #26731 (comment) |
A big +1! Not only in FSE, also everywhere in the block editor even in the classic block. At this point autop should only be a "back-compat for older posts" there, really. It doesn't have any other role :) A bit of history: autop was introduced very early in WP when the editor was just a plain textarea. There it made the Edit Post UX much more appealing by converting two |
I'm not sure I understand all the implications of this PR but can we rebase it and try to land it? |
Closing in favor of #30552 which does the same but is more ready to land. Thanks @bobbingwide |
Oh good! Now perhaps we can see if |
Only needed for back-compat with Actually... Looking at https://github.com/WordPress/gutenberg/blob/trunk/packages/block-library/src/template-part/index.php what's the purpose of Investigating further... |
Description
When rendering template parts the call to
wpautop()
could produce unwanted</p>
tags.I've removed the call to
wpautop()
from the routines run against the $content in(gutenberg_)render_block_core_template_part()
to prevent this happening.How has this been tested?
I created a simple test that demonstrated the problem, then fixed the problem, and retested.
Screenshots
For screenshots see the issue #26731
Types of changes
Fixes #26731
Checklist:
I haven't run any PHPUnit tests.