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.
#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.
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.
#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,
));
}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.