Support

Account

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

  • Actually scratch that, acf_load_field is too powerful and actually prevents you from setting the fields to be required anywhere.

    My solution was to set the fields to be NOT required and then make them required only on the frontend form, like so:

    add_filter('acf/load_field/key=field_XYZ', 'custom_field_required_fields');
    function custom_field_required_fields($field) {
      if (!is_admin()) {
        $field['required'] = true;
      }
      return $field;
    }