$form = array(
'name' => 'my-form',
'title' => 'My Form',
'post_id' => 0,
'field_groups' => array(),
'actions' => array(),
'render' => '',
'settings' => array(
'ajax' => false, // pro only
'location' => false,
'honeypot' => true,
'kses' => true,
'uploader' => 'default',
),
'attributes' => array(
'form' => array(
'element' => 'form',
'class' => '',
'id' => '',
),
'fields' => array(
'element' => 'div',
'wrapper_class' => '',
'class' => '',
'label' => 'top',
'instruction' => 'label',
),
'submit' => array(
'value' => 'Submit',
'button' => '<input type="submit" class="acf-button button button-primary button-large" value="%s" />',
'spinner' => '<span class="acf-spinner"></span>',
),
),
'validation' => array(
'hide_error' => false,
'hide_revalidation' => false,
'hide_unload' => false,
'errors_position' => 'above',
'errors_class' => '',
'messages' => array(
'failure' => 'Validation failed',
'success' => 'Validation successful',
'error' => '1 field requires attention',
'errors' => '%d fields require attention',
),
),
'success' => array(
'hide_form' => false,
'scroll' => false,
'message' => 'Post updated',
'wrapper' => '<div id="message" class="updated">%s</div>',
),
);
Slug name of the form. Default: ''
The title of the form. Default: ''
The post id of the page where the form is currently displayed. Default: 0
An array of field groups that will be displayed on the front-end if the render
argument is empty. Default: array()
An array of actions defined for this form. See actions documentation for more information. Default: array()
The HTML render of the form. Leaving this setting empty will automatically render Field Groups from the field_groups
argument. Add a custom value allow to override this default logic and render arbitrary HTML. Default: ''
#location
Should displayed Field Groups apply their Field Group Locations on the front-end. Default: false
#honeypot
Add spam detection measures. This setting prepends a hidden text input that should stay empty. Bots and autocompleters might get trapped and try to fill it. In that case, the form validation will throw an error. Default: true
#kses
Use the WP Kses sanitization logic. This setting will disallow potentially dangerous field values such as <script></script>
. See documentation. Default: true
#uploader
The uploader type used for the ACF Image / File fields. The default setting will respect the “Uploader Type” setting of each field. Default: 'default'
#form > element
Define the HTML tag of the <form>
element. Default: 'form'
#form > class
Define the class added to the <form>
element. Default: ''
#form > id
Define the id attribute of the form element. Default: ''
#fields > element
Define the HTML tag of the ACF Fields elements. Default: 'div'
#fields > wrapper class
Define the class added to the ACF Fields elements. Default: ''
#fields > class
Define the class added to the input of ACF Fields. Default: ''
#fields > label
Define the label position of the ACF Fields. Default: 'top'
#fields > instruction
Define the instructions placement of the ACF Fields. Default: 'label'
#hide error
Hide the general error message: “Validation failed. 1 field requires attention”. Default: false
#hide revalidation
Hide the successful notice when an error has been thrown. Default: false
#hide unload
Do not prompt user on page refresh. Default: false
#errors position
Choose where to display field errors. Default: above
#errors class
Add class to the error message. Default: ''
#messages > failure
The global error “Validation failed”. Default: 'Validation failed'
#messages > success
The global message “Validation successful” when the form has been validated. Default: 'Validation successful'
#messages > error
The global error “1 field requires attention”. Default: 1 field requires attention'Validation failed'
#messages > errors
The global error “2 fields require attention”. Default: %d fields require attention'Validation failed'
#hide form
Hide form on successful submission. Default: false
#scroll
Scroll to the success message on successful submission. Default: false
#message
The success message. Default: 'Post updated'
#wrapper
The HTML wrapper of the success message. Default: <div id="message" class="updated">%s</div>