Home Forums Front-end Issues Make fields required only on front-end form?


Make fields required only on front-end form?

  • I realize that, when using a front-end form, I can use other forms of validation for ACF fields. But before I do that, I’m wondering if there’s a way to do this within ACF.

    I have custom fields saving user meta and I’d like to require certain fields when filling out the front-end form, but I don’t want those fields to be required on the back end. So that, if someone is changing their password or updating their nickname or whatever, and they haven’t yet filled out these extra profile fields, they don’t get validation errors.

    (Running ACF Pro 5.7.9)

  • I am looking for this functionality as well. Has anyone come up with a good solution since?

    The form changes regularly and has conditional questions that are required if they are shown – so I’d like to avoid custom scripts to do it. My client also doesn’t have the budget to pay me to do that.

    Would there be a way to disable the required fields on the backend?

  • use see options there

    add_filter('acf/prepare_field', 'required_on_front');
    required_on_front($field) {
      if (!is_admin()) {
        $field['required'] = true,
      return $field;
  • Thanks for the snippet.

    I made two changes. One was to add the ‘function’, and the second was to change it so that no Admin fields are required vs making all Front End fields required.

    add_filter('acf/prepare_field', 'not_required_in_admin');
            function not_required_in_admin($field) {
                if (is_admin()) {
                    $field['required'] = false;
            return $field;
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.