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?

  • 1
    Is this still an issue?
    – bosco
    Jun 29, 2021 at 21:23


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.