Home Forums Bug Reports No content after inner blocks


No content after inner blocks

  • Hi,

    the following code is producing strange – probably faulty – results. I tried to strip the callback as much as possible and put it into a anonymus function. Also this is tested with the twentytwentytwo theme and no plugins active – besides acf pro of course:

    function acf_register_acf_test_block_type() {
    	acf_register_block_type( array(
    		'name'            => 'acf-test',
    		'title'           => __( 'acf-test' ),
    		'render_callback' => function(){echo 'before - <InnerBlocks /> - after';},
    		'category'        => 'ACF TEST',
    		'mode'            => 'preview',
    		'supports'        => array(
    			'align' => false,
    			'mode'  => true,
    			'jsx'   => true
    	) );
    // Check if function exists and hook into setup.
    if ( function_exists( 'acf_register_acf_test_block_type' ) ) {
    	add_action( 'acf/init', 'acf_register_acf_test_block_type' );

    In the frontend the output is as expected: before – WHATEVER WAS INSERTED AS INNER BLOCK – after. In the editor however, anything after <InnerBlocks /> isn’t displayed.

    Am I missing something here?

  • Did you figure this out? I’m having the same issue.

    Anything before <InnerBlocks /> displays on the editor and front-end. Anything after that element displays on the front-end only, but not the editor.

  • Sorry, but unfortunately I didn’t. Good luck!

  • I just had the same issue but managed to get it working by wrapping the <Innerblocks /> tag in div tags like this:

    <div><InnerBlocks /></div>

  • You’re a star, thank you! It worked!

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

You must be logged in to reply to this topic.