• Resolved slimx

    (@slimx)


    Hi,

    Great plugin. Saved me a lot of time.
    I’m trying to create a table field programmatically but for some reason it’s not working. Here is part of my code.

    register_field_group(array (
            'id' => 'acf_test-table',
            'title' => 'Test table',
            'fields' => array (
              array (
                //'key' => 'field_568a92ec26958',
                'key' => 'test_table',
                'label' => 'TestTable',
                'name' => 'test_table',
                'type' => 'table',
                'use_header' => 1,
              ),
              array (
                'key' => 'field_5323276db7e18',
                'label' => 'Email Address',
                'name' => 'email_address',
                'type' => 'email',
                'required' => 1,
                'default_value' => '',
                'placeholder' => '',
                'prepend' => '',
                'append' => '',
              ),
            ),
            'location' => array (
              array (
                array (
                  'param' => 'post_type',
                  'operator' => '==',
                  'value' => 'post',
                  'order_no' => 0,
                  'group_no' => 0,
                ),
              ),
            ),
            'options' => array (
              'position' => 'normal',
              'layout' => 'default',
              'hide_on_screen' => array (
              ),
            ),
            'menu_order' => 4,
          ));

    The test e-mail address field is created. However, the table field isn’t.

    Hope you can help me.
    Thanks,
    Sharif.

    https://www.ads-software.com/plugins/advanced-custom-fields-table-field/

Viewing 1 replies (of 1 total)
  • Thread Starter slimx

    (@slimx)

    Just figured out what was wrong.

    I think the ID chosen for the table field was having some conflict with a previous table test.

    Sorry for the spam. I’ll try to be less anxious next time.

    Regards.

Viewing 1 replies (of 1 total)
  • The topic ‘Cannot create acf table field programmatically’ is closed to new replies.