Getting started

First you need to create a Field Group that will contain the form’s fields. Then create a new Form from the ACF > Forms menu and assign that Field Group to the form. Once saved, the form will now map the Fields from the Field Group. This means those fields will be usable directly from the UI.

Out-of-the-box, the form will do nothing on submission. You’ll have to add one or multiple actions to define what you want to do with the form.

Note that you don’t need to use acf_form_head() in your front-end template anymore. The ACF Extended automatically handle that part.

PHP Integration

You can display the form using the acfe_form() function. Usage example:

<?php get_header(); ?>

    <?php 
    
    // Using Form Name
    acfe_form('my-form');
    
    // Using Form ID
    acfe_form(120);
    
    // Using Form Array
    acfe_form(array(
        'name' => 'my-form'
    ));
    
    ?>
    
<?php get_footer(); ?>

PHP Settings

It is possible to override form settings directly in PHP by passing the setting key and its value.

acfe_form(array(
    'name'         => 'my-form',    // Call by name
    'uploader'     => 'basic',      // Force Uploader to basic
    'submit_value' => 'Submit Form' // Change Submit text
));

PHP Custom Data

You can pass custom data to the form using PHP. These data can then be retrieved in the UI using the {form:my_key} Template Tag or in PHP hooks using the $form['my_key'] parameter.

acfe_form(array(
    'name'    => 'my-form',
    'my_user' => get_current_user_id() // Add Current User ID
));

Custom data can also be passed using the acfe/form/load filter. See documentation. Usage example:

add_filter('acfe/form/load/form=my-form', 'my_form_settings', 10, 2);
function my_form_settings($form, $post_id){
    
    // Add Current User ID
    $form['my_user'] = get_current_user_id();
    
    // Return
    return $form;
    
}

PHP Conditional Render

It is possible to display the form based on classic PHP conditions. In this example, the form will be only displayed when the current user is also the current post author:

// retrieve user & post author info
$current_user_id = get_current_user_id();
$post_author_id = get_the_author_meta('ID');

// check if the current user is also the post author
if($current_user_id === $post_author_id){
    
    // render form
    acfe_form('my-form');
    
}

Conditions can also be set using the acfe/form/load filter. See documentation. Usage example:

add_filter('acfe/form/load/form=my-form', 'my_form_settings', 10, 2);
function my_form_settings($form, $post_id){
    
    // retrieve user & post author info
    $current_user_id = get_current_user_id();
    $post_author_id = get_the_author_meta('ID');
    
    // check if the current user is different from the post author
    if($current_user_id !== $post_author_id){
        
        // hide the form
        return false;
        
    }
    
    // return
    return $form;
    
}

Shortcode Integration

You can use the [acfe_form] shortcode in order to display the form in the WordPress Editor. Usage example:

// Using Form Name
[acfe_form name="my-form"]

// Using Form ID
[acfe_form ID="120"]

Shortcode Settings

Just like the PHP integration, it is possible to override form settings directly from the shortcode. Usage example:

[acfe_form name="my-form" uploader="basic" submit_value="Submit Form"]

Shortcode Custom Data

To pass custom data, simply add the custom key within the shortcode. These data can then be retrieved in the UI using the {form:my_key} Template Tag or in PHP hooks using the $form['my_key'] parameter.

[acfe_form name="my-form" my_user="12"]

Shortcode Conditional Render

The [acfe_form] shortcode doesn’t have builtin conditional render settings. Instead, the acfe/form/load filter should be used to hide or display the form conditionally. See documentation.

In this example, the form will be only displayed when the current user is also the current post author:

add_filter('acfe/form/load/form=my-form', 'my_form_settings', 10, 2);
function my_form_settings($form, $post_id){
    
    // retrieve user & post author info
    $current_user_id = get_current_user_id();
    $post_author_id = get_the_author_meta('ID');
    
    // check if the current user is different from the post author
    if($current_user_id !== $post_author_id){
        
        // hide the form
        return false;
        
    }
    
    // return
    return $form;
    
}

Settings Cheatsheet

$args = array(
    'ID'                    => 2274,
    'name'                  => 'my-form',
    'title'                 => 'My Form',
    'post_id'               => 410,
    'field_groups'          => array(
        'group_61170173ec47f',
    ),
    'field_groups_rules'    => false,
    'post_field_groups'     => false,
    'form'                  => true,
    'html_before_fields'    => '',
    'custom_html_enabled'   => false,
    'custom_html'           => false,
    'html_after_fields'     => '',
    'form_submit'           => true,
    'submit_value'          => 'Submit',
    'html_submit_button'    => '<input type="submit" class="acf-button button button-primary button-large" value="%s" />',
    'html_submit_spinner'   => '<span class="acf-spinner"></span>',
    'hide_error'            => false,
    'hide_unload'           => false,
    'hide_revalidation'     => false,
    'errors_position'       => 'above',
    'errors_class'          => '',
    'updated_message'       => '<p>Success!</p>',
    'html_updated_message'  => '<div id="message" class="updated">%s</div>',
    'updated_hide_form'     => false,
    'honeypot'              => true,
    'kses'                  => true,
    'uploader'              => 'default',
    'field_el'              => 'div',
    'label_placement'       => 'top',
    'instruction_placement' => 'label',
    'form_attributes'       => array(
        'id'                        => '',
        'class'                     => 'acfe-form acf-form',
        'action'                    => '',
        'method'                    => 'post',
        'data-fields-class'         => '',
        'data-hide-error'           => false,
        'data-hide-unload'          => false,
        'data-hide-revalidation'    => false,
        'data-errors-position'      => 'above',
        'data-errors-class'         => '',
    ),
    'fields_attributes'     => array(
        'wrapper_class'             => '',
        'class'                     => '',
    ),
);

FREEShortcode Placeholder

The Shortcode display a placeholder within the WordPress Editor.

Field Group

PROShortcode Preview

It is possible to display a form preview directly within the WordPress editor using the Shortcode Preview setting.

Field Group

The Shortcode Preview setting is disabled by default. It can be enabled and disabled in the Settings UIPRO, or with the following code:

add_action('acf/init', 'my_acfe_modules');
function my_acfe_modules(){

    // Enable Shortcode Preview for all Forms
    acf_update_setting('acfe/modules/forms/shortcode_preview', true);

    // Enable Shortcode Preview for all Forms
    acf_update_setting('acfe/modules/forms/shortcode_preview', array());

    // Enable Shortcode Preview for specific Forms
    acf_update_setting('acfe/modules/forms/shortcode_preview', array('my-form'));
    
}