Support

Account

Home Forums Gutenberg Core-Embed with InnerBocks

Solved

Core-Embed with InnerBocks

  • Hi –
    I’m trying to use the InnerBlock functionality with some of the wordpress core-embed blocks – such as Vimeo.

    The issue I’m running into is: How do I render the vimeo core-embed block when it’s an innerblock?

    Here’s how I handle this with blocks normally (when they aren’t nested):

                $blocks = parse_blocks( $post->post_content );
                foreach( $blocks as $block ) {
                    if( $block['blockName'] === 'core/embed'){ 
              		    echo apply_filters( 'the_content', render_block( $block ) );
                    }else{
                        echo render_block( $block );
              	     }
                }

    I’ve tried accessing and looping through the $block[‘innerContent’], but not having much luck. Wondering if anyone else has run into this issue and has an elegant solution?

    Ideally it would be nice to have some global function that applies the filter, or not, based on the block type.

  • Figured it out. I was doing it wrong. Solution is simply:

    the_content();

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.