Home › Forums › Bug Reports › 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.
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 must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.