Gutenberg Blocks doesn’t render correctly when using do_blocks

I’m trying to render a post_content with blocks using the do_blocks function, that takes a gutenberg content, parses every block, and returns an HTML string.

The problem is that some blocks aren’t rendering correctly. I suppose it is because do_blocks doesn’t enqueue the blocks scripts, it only parses the blocks.

For example, the core-embed/youtube instead of rendering the iframe of the YouTube video, only shows the video URL.

bug example

Blocks that renders using the a PHP render_callback function renders correctly, so its seems related to JS.

Is there a solution to this?

0

Leave a Comment