Cheatsheet

$form = array(
    'name'         => 'my-form',
    'title'        => 'My Form',
    'post_id'      => 145,
    'field_groups' => array(
        'group_65c5d17e0e9bd',
    ),
    'actions' => array(),
    'render'  => '',
    'settings' => array(
        'ajax'     => false, // pro only
        'location' => false,
        'honeypot' => true,
        'kses'     => true,
        'uploader' => 'default',
    ),
    'attributes' => array(
        'form' => array(
            'element' => 'form',
            'class'   => 'acf-form',
            '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'      => '',
    ),
    'success' => array(
        'hide_form' => false,
        'scroll'    => false,
        'message'   => 'Post updated',
        'wrapper'   => '<div id="message" class="updated">%s</div>',
    ),
);

Name

Slug name of the form. Default: ''

Title

The title of the form. Default: ''

Post id

The post id of the page where the form is currently displayed. This setting is for internal use, we recommend to not change it. Default: 0

Field Groups

An array of field groups that will be displayed on the front-end if the render argument is empty. Default: array()

Actions

An array of actions defined for this form. See actions documentation for more information. Default: array()

Render

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: ''

Settings

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'

Attributes > form

form > element

Define the HTML tag of the <form> element. Default: 'form'

form > class

Define the class added to the <form> element. Default: 'acf-form'

form > id

Define the id attribute of the form element. Default: ''

Attributes > fields

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'

Validation

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: ''

Success

hide form

Hide form on successful submission. Default: false

scroll to message

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>