Support

Account

Home Forums Gutenberg Generated ID using pre_save_block not working

Unread

Generated ID using pre_save_block not working

  • I;m trying to generated an ID saved with each individual Block of a specific type, I;m using the example given in the documentation but no joy, any ideas?

    function generate_unique_block_id_for_acf_waveform_block( $attributes ) {
        if ( isset($attributes['blockName']) && $attributes['blockName'] === 'acf/waveform' ) {
            if ( empty( $attributes['anchor'] ) ) {
                $attributes['anchor'] = uniqid();
            }
        }
        return $attributes;
    }
    add_filter( 'acf/pre_save_block', 'generate_unique_block_id_for_acf_waveform_block', 10, 1 );
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.