• Resolved oliver1979

    (@oliver1979)


    If I add ACF fields programmatically within my plugin with the following code, the ACF-VC INTEGRATOR SETTINGS popup looks like this (there are two Field name selects):

    Field group (i)
    Test group 1 (selected)
    Test group 2

    Field name
    Test2 (only one item in the list)

    Field name
    Test2 (only one item in the list)

    If I change the Field group, nothing happens with both “Field name” select fields. “Test2” stays the only item in both selects. If I assign the second field group to another post type, it stil does not work.

    add_action('acf/init', 'add_my_custom_fields');

    function add_my_custom fields() {
    acf_add_local_field_group(array(
    'key' => 'test_grp1',
    'title' => __( 'Test group 1', 'test'),
    'menu_order' => 0,
    'location' => array (
    array (
    array (
    'param' => 'post_type',
    'operator' => '==',
    'value' => 'page',
    ),
    ),
    ),
    'fields' => array(
    array(
    'key' => 'field_page_test1',
    'label' => __( 'Test1', 'test'),
    'name' => 'page_test1',
    'type' => 'text',
    )
    )
    ));

    acf_add_local_field_group(array(
    'key' => 'test_grp2',
    'title' => __( 'Test group 2', 'test'),
    'menu_order' => 1,
    'location' => array (
    array (
    array (
    'param' => 'post_type',
    'operator' => '==',
    'value' => 'page',
    ),
    ),
    ),
    'fields' => array(
    array(
    'key' => 'field_page_test2',
    'label' => __( 'Test2', 'test'),
    'name' => 'page_test2',
    'type' => 'text',
    )
    )
    ));
    }

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.