blocks-everywhere icon indicating copy to clipboard operation
blocks-everywhere copied to clipboard

Don't call do_blocks on non-block comments

Open alshakero opened this issue 2 years ago • 2 comments

Parsing plain text is wasteful, and more importantly breaks core WordPress tests when Blocks Everywhere is enabled.

Because the core tests have a comment with the body "Hello World", which is parsed into a block without a name. And this breaks this assertion, since the comment will contain 6 blocks (not 5) and one of them will be a nameless block with innerHTML=Hello World.

alshakero avatar Oct 20 '23 12:10 alshakero

The core do_blocks doesn't have this check:

https://core.trac.wordpress.org/browser/trunk/src/wp-includes/blocks.php#L1504

Why is it needed here and not in core?

johngodley avatar Oct 20 '23 13:10 johngodley

Hi @Johngodley, thank you for reviewing, good point, I think we need it there too. We did not know about this same logic in core. Thank you

renancarvalho avatar Oct 26 '23 10:10 renancarvalho