I'm working on a custom theme, and I would like to display the facebook embed from Gutenberg in Wordpress. I've done parse_blocks and then printing the block displays just the facebook url.

// page-home.php
$post = get_post();
if (has_blocks($post->post_content)) {
  $blocks = parse_blocks($post->post_content);
  foreach($blocks as $block){
    if ($block[blockName] === 'core/embed/facebook') {
      // starting to get stuck here...

How do I display the facebook embed?

  • To output the content of the editor, including embed blocks, you should only need to use the_content();. – Jacob Peattie Oct 10 '19 at 3:42
  • @JacobPeattie I just tried it, but I don't think that does what I want. I'm seeing that all contents of the page prints, and the embed is just a facebook url in text. I'm losing hope, I don't think that it's gonna work. – Joseph K. Oct 10 '19 at 3:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.