Support

Account

Home Forums Gutenberg InnerBlocks doesn't work if the block is not added with the inserter

Helping

InnerBlocks doesn't work if the block is not added with the inserter

  • Hi!
    Maybe I’m doing something wrong but if I have a post type with blocks template locked

    'template' => array(
    	array( 'acf/test' ),
    	array( 'acf/test2' ),
    ),
    'template_lock' => 'all'

    and if there is an InnerBlocks in one of the block render with <InnerBlocks /> the editor doesn’t work (not initialized I think).
    If the block is added with the inserter all is ok.
    Has anyone also had this problem?
    Thanks in advance,
    David

  • I found the problem, if your innerblocks is in a template locked you need to add templateLock="false" like that echo '<InnerBlocks allowedBlocks="' . esc_attr( wp_json_encode( $allowed_blocks ) ) . '" templateLock="false" />';

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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.