You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
HTML Block adding random close tags and line breaks on template pages #50173
HTML Block adding in random </p> and <br /> tags throughout the HTML block. I notice it most in ones where I have an SVG within the HTML block as it breaks the SVG and it sometimes stops displaying. The HTML block keeps trying to close P tags that were never present, and adding in line breaks to SVGs completely breaking them.
Step-by-step reproduction instructions
Create a custom product template.
Add in a HTML block.
Add code, including an SVG.
View page.
Return to template
See added </p> and <br /> tags throughout code that were not present before.
Thanks, @dalebridge ! For security reasons I'm not going to be able to open the attachment, so thanks for reading my mind and copy-pasting the code above. :)
@dalebridge I haven't been able to replicate the problem so far when creating a custom page template – I'm not seeing any stray tags added to the code you provided, in an HTML block.
Create a custom product template.
Are you finding that this issue only happens with Woo product templates specifically, or can you get it happen with core templates as well?
@dalebridge Yep, I understand that. :) In your testing instructions you said "Create a custom product template."
WooCommerce and product templates like the "Single Item: Product" example in your video are not part of WordPress core. So I was wondering if if you've been able to replicate this with any of the templates that are part of core, as you see here:
I tried adding a Custom HTML block with the sample code you provided earlier (seems like it's been deleted now?) but was not able to replicate the issue with stray tags appearing, so far:
New environment again, no WooCommerce installed, just 6.2.
Editing Home template, no changes to the page other than the added HTML block to paste my HTML into.
Pasted in code into the HTML block (this one doesn't include an SVG, purely divs and a tags.)
After saving, leaving the page and coming back, it adds in a load of <p></p> tags throughout the code, ruining the flex box css I had applied to the classes. Code for this is below, along with a video demonstration.
Help us move this issue forward. This issue is being marked stale since it has no activity after 15 days of requesting more information. Please add info requested so we can help move the issue forward. Note: The triage policy is to close stale issues that need more info and no response after 2 weeks.
This appears resolved. The root cause, autop() running on raw block content when the freeform fallback block was core/html in the site editor/templates, should be fixed by #52716, which shipped in WordPress 6.3. That fix is still present in trunk (packages/blocks/src/api/parser/index.ts, gating autop to core/freeform only).Closing as fixed. If anyone can still reproduce this on a current release with a minimal repro, please reopen with the steps and environment details.
Activity
kathrynwp commentedon May 1, 2023
Hey there @dalebridge - thanks for the report.
In order for me to try to replicate the issue, could you please provide a short piece of sample code that I can try in an HTML block? Thanks!
dalebridge commentedon May 1, 2023
hi @kathrynwp , the code is added above in code.txt.
If you need anything else let me know!
kathrynwp commentedon May 1, 2023
Thanks, @dalebridge ! For security reasons I'm not going to be able to open the attachment, so thanks for reading my mind and copy-pasting the code above. :)
dalebridge commentedon May 1, 2023
@kathrynwp
https://gist.github.com/dalebridge/df5b4da8192f3152bc110df2cf6ff1aa
kathrynwp commentedon May 1, 2023
@dalebridge I haven't been able to replicate the problem so far when creating a custom page template – I'm not seeing any stray tags added to the code you provided, in an HTML block.
Are you finding that this issue only happens with Woo product templates specifically, or can you get it happen with core templates as well?
dalebridge commentedon May 1, 2023
It only happens in templates, not posts
dalebridge commentedon May 1, 2023
@kathrynwp it only happens on block templates
kathrynwp commentedon May 1, 2023
@dalebridge Yep, I understand that. :) In your testing instructions you said "Create a custom product template."
WooCommerce and product templates like the "Single Item: Product" example in your video are not part of WordPress core. So I was wondering if if you've been able to replicate this with any of the templates that are part of core, as you see here:
I tried adding a Custom HTML block with the sample code you provided earlier (seems like it's been deleted now?) but was not able to replicate the issue with stray tags appearing, so far:
dalebridge commentedon May 1, 2023
I deleted that code as it formatted it inline after pasting into a code-block here, rather than how I had been using it, so I wanted to give you an accurate version of the code via gist. https://gist.github.com/dalebridge/df5b4da8192f3152bc110df2cf6ff1aa
https://www.loom.com/share/30b07eddd73348baa557df9c8765c785
I used a "single item: product", but it did the same on home template too @kathrynwp
dalebridge commentedon May 1, 2023
@kathrynwp and on home template with a fresh install – https://www.loom.com/share/17d0914ced7d4b40a197b43f318fdc3e
Rocking in this environment:
wordpress 6.2
woocommerce 7.6.0
dalebridge commentedon May 2, 2023
@kathrynwp
New environment again, no WooCommerce installed, just 6.2.
Editing Home template, no changes to the page other than the added HTML block to paste my HTML into.
Pasted in code into the HTML block (this one doesn't include an SVG, purely divs and a tags.)
After saving, leaving the page and coming back, it adds in a load of
<p></p>tags throughout the code, ruining the flex box css I had applied to the classes. Code for this is below, along with a video demonstration.https://www.loom.com/share/732c736601354b7984c11e076e60dbc7
https://gist.github.com/dalebridge/81540ef6df25ec3666f1e0f2dff8da4d
connah99 commentedon May 2, 2023
There's another issue regarding the same topic. Some testing and examples are in there too, in case that's of any help
Related: Custom HTML block adding extra characters #49166
github-actions commentedon May 18, 2023
Help us move this issue forward. This issue is being marked stale since it has no activity after 15 days of requesting more information. Please add info requested so we can help move the issue forward. Note: The triage policy is to close stale issues that need more info and no response after 2 weeks.
dalebridge commentedon May 18, 2023
There has been more information added. It is all above. Code. How to replicate. Videos of the issue in action.
jordesign commentedon Aug 8, 2023
It appears this should be resolved with the update to WordPress 6.3
#49166
@dalebridge can you please let me know if you still see this issue in place after updating to the latest version of WordPress?
homebrandcola commentedon Aug 30, 2024
Just ran into this issue in 6.6.1 running theme twenty twenty-two
I have some custom script and an input box on a page and when I add it, it gets populated with
and
tags throughout the script and breaks it all.
I see the issue is still open, but was supposed to fixed in 6.3?
carolinan commentedon Mar 18, 2026
I am not able to reproduce this:
(Gutenberg is not active)
jasmussen commentedon Aug 26, 2026
This appears resolved. The root cause, autop() running on raw block content when the freeform fallback block was core/html in the site editor/templates, should be fixed by #52716, which shipped in WordPress 6.3. That fix is still present in trunk (packages/blocks/src/api/parser/index.ts, gating autop to core/freeform only).Closing as fixed. If anyone can still reproduce this on a current release with a minimal repro, please reopen with the steps and environment details.