Support

Account

Home Forums Gutenberg ACF gutenberg tag field doesn't save

Unread

ACF gutenberg tag field doesn't save

  • Your support system is down……

    Hi there,
    I have a problem with ACF Gutenberg blocks not working in specific case.
    I want to be able to select specific news + specific tags.
    So I created this field:

    acf_add_local_field_group(array(
            'key'                   => 'group_5cbe885ee190f',
            'title'                 => 'Block: Related content',
            'fields'                => array(
                array(
                    'key'               => 'field_5cbe88701e944',
                    'label'             => 'Related case studies',
                    'name'              => 'related_case_studies',
                    'type'              => 'post_object',
                    'instructions'      => 'Select related case studies',
                    'required'          => 0,
                    'conditional_logic' => 0,
                    'wrapper'           => array(
                        'width' => '',
                        'class' => '',
                        'id'    => '',
                    ),
                    'post_type'         => array(
                        0 => 'post',
                    ),
                    'taxonomy'          => '',
                    'allow_null'        => 0,
                    'multiple'          => 1,
                    'return_format'     => 'id',
                    'ui'                => 1,
                ),
                array(
                    'key' => 'field_5cbe43102f4e6',
                    'label' => 'Related tag',
                    'name' => 'related_tag',
                    'type' => 'taxonomy',
                    'instructions' => '',
                    'required' => 0,
                    'conditional_logic' => 0,
                    'wrapper' => array(
                        'width' => '',
                        'class' => '',
                        'id' => '',
                    ),
                    'taxonomy' => 'post_tag',
                    'field_type' => 'multi_select',
                    'allow_null' => 0,
                    'add_term' => 0,
                    'save_terms' => 0,
                    'load_terms' => 1,
                    'return_format' => 'id',
                    'multiple' => 0,
                ),
                array(
                    'key'               => 'field_5cbfe272c9326',
                    'label'             => 'Block title',
                    'name'              => 'block_title',
                    'type'              => 'text',
                    'instructions'      => 'The title to use eg: "More Insights". Defaults to "Related".',
                    'required'          => 0,
                    'conditional_logic' => 0,
                    'wrapper'           => array(
                        'width' => '',
                        'class' => '',
                        'id'    => '',
                    ),
                    'default_value'     => 'Related',
                    'placeholder'       => '',
                    'prepend'           => '',
                    'append'            => '',
                    'maxlength'         => '',
                ),
            ),
            'location'              => array(
                array(
                    array(
                        'param'    => 'block',
                        'operator' => '==',
                        'value'    => 'acf/related',
                    ),
                ),
            ),
            'menu_order'            => 0,
            'position'              => 'acf_after_title',
            'style'                 => 'seamless',
            'label_placement'       => 'top',
            'instruction_placement' => 'label',
            'hide_on_screen'        => '',
            'active'                => true,
            'description'           => '',
        ));
    

    Now out of this post and title works but tag doesn’t. Why? Because it’s not recognised by ACF. Here’s test post content:

    <!-- wp:acf/related {"id":"block_60055cc22371a","name":"acf/related","data":{"related_case_studies":["16043"],"_related_case_studies":"field_5cbe88701e944","related_tag":["240"],"_related_tag":"field_5cbe43102f4e6","block_title":"Related","_block_title":"field_5cbfe272c9326"},"align":"","mode":"preview"} /-->
    

    When admin page loads, case study field preloads with the right article, but tag field doesn’t – it’s empty on the sidebar. And the ID is correct 240 is correct taxonomy ID. Any hints?

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.