Form Title & Content Fields

Guides Front-End Forms Form Title & Content Fields

#Overview

In this guide we’ll learn how to create a dummy Post Title & Post Content fields for the front-end form. In fact, ACF Extended doesn’t create these fields in order to give you full control over fields types (text, textarea, editor…), their settings (required, max length…) and their placement in the form.

#Method 1: Dummy Field Group

#Using the Field Group UI

Create a dummy Field Group with the “Title” and the “Content” fields. Set the Field Group as disabled so it’s never displayed in the back-end.

ACF Extended
Howdy, ACF Extended
Field GroupsAdd New
TitleFieldsLocation
My Field Group
Edit | Duplicate | Trash | group_5ffeea53d3402
3 Posts
My Form
Edit | Duplicate | Trash | group_5ffccf3e2a7ff
5 Posts
Title + Content
Edit | Duplicate | Trash | group_5ff920427c67b
2 Posts
TitleFieldsLocation

Then in the Form UI, map the dummy Field Group and the actual Form Field Group. All fields will become available in the Actions UI.

Dynamic Form

#Using a Local Field Group

Alternatively, if you don’t want to pollute your Field Groups UI list with a dummy Field Group, you could export it in PHP, paste the code in your theme’s functions.php file and forget it. It will be always available for any form you create.

Here is one you can use:

add_action('acf/init', 'my_acfe_form_title_content');
function my_acfe_form_title_content(){
        
    acf_add_local_field_group(array(
        'key' => 'group_my_acfe_form_title_content',
        'title' => 'Title + Content',
        'fields' => array(
            array(
                'key' => 'field_title',
                'label' => 'Title',
                'name' => 'title',
                'type' => 'text',
                'instructions' => '',
                'required' => 0,
                'conditional_logic' => 0,
                'wrapper' => array(
                    'width' => '',
                    'class' => '',
                    'id' => '',
                ),
                'default_value' => '',
                'maxlength' => '',
                'placeholder' => '',
                'prepend' => '',
                'append' => '',
            ),
            array(
                'key' => 'field_content',
                'label' => 'Content',
                'name' => 'content',
                'type' => 'textarea',
                'instructions' => '',
                'required' => 0,
                'conditional_logic' => 0,
                'wrapper' => array(
                    'width' => '',
                    'class' => '',
                    'id' => '',
                ),
                'default_value' => '',
                'maxlength' => '',
                'rows' => '',
                'placeholder' => '',
                'new_lines' => '',
            ),
        ),
        'location' => array(),
        'menu_order' => 0,
        'position' => 'normal',
        'style' => 'default',
        'label_placement' => 'left',
        'instruction_placement' => 'label',
        'hide_on_screen' => '',
        'active' => false,
        'description' => '',
        'show_in_rest' => 0,
    ));
    
}

#Method 2: Fields within the Field Group

An alternative method is to add the Title & Content fields directly in the Field Group mapped in your form. You can then hide them in the back-end using your preferred method.

See our guide on how to hide a field in the admin.