Support

Account

Home Forums ACF PRO Exclude some subfields of repeater in acf_form()

Helping

Exclude some subfields of repeater in acf_form()

  • Hey,

    I’m using acf_form() and want to exclude some subfields of an repeater. I know there is no exclude function but just list some of the subfields in the fields option doesn’t work.

    So if I have these fields:

    
    field_1
    field_2 (repeater)
      field_21
      field_22
    field_3
    

    I want to do something like that:

    
    acf_form({
      'fields' => ['field_1', 'field_21'],
    });
    

    That works but field_21 is just a single field and not in a repeater.

  • You could try this before calling acf_form in your template

    backup you’re database first. I think this should only remove the field for the display of the one form, but you can never be too careful.

    
    acf_remove_local_field('field_0123456789abc');
    acf_form();
    

    This is a more recent function in ACF5, and I haven’t had any reason to use it.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.