Support

Account

Home Forums Front-end Issues Remove specific field from acf_form

Solved

Remove specific field from acf_form

  • Hi, how I can remove specific field located in repeater from acf_form?

    I know only with css, but how on backend side do this trick?

      acf_form(array(
        'id' => CURRENT_ID,
      	'fields' => array(
          'field_5a928853b84de',
          'recaptcha'
        ),
        'submit_value' => 'Submit',
        'updated_message' => 'Thanks!',
      ));

    field_5a928853b84de is the repeater field, that cointains “true / false” field. I want remove it only on frontend.

  • Solved with:

    add_filter('acf/prepare_field/key=field_5a93cdad837af', function($field){
      if(in_array(CURRENT_USER_ROLE, array('administrator','owner'))){
        return $field;
      }
      return false;
    });
  • I tried this approach but I wasn’t able to save any rows that were added to the repeater.

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

You must be logged in to reply to this topic.