Support

Account

Home Forums Gutenberg Block content is duplicating on the front end but looks fine in the back end. Reply To: Block content is duplicating on the front end but looks fine in the back end.

  • I have run into this issue as well. I’ve been trying to recreate it with a stripped down simple innerblocks test but have been having trouble getting it to reliably trigger.

    It seems to have something to do with the block IDs that are being generated by ACF. When copying a block, it copies the ID and does not generate a new one until certain conditions are met (usually altering custom fields).

    This code seemed to resolve the issue for me, although I’d like to see a fix in ACF proper.

    add_filter( ‘acf/pre_save_block’, function( $attributes ) {
    if ( empty( $attributes[‘id’] ) ) {
    $attributes[‘id’] = ‘block_’ . uniqid();
    }

    return $attributes;
    }, 10, 1 );