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

The unique form slug

Render & map fields of the following field groups

Add actions on form submission

Click the "Add action" button below to start creating your layout
0 Custom action

Set a unique action slug.

0 Email action
0 Option action

Fill inputs with values

0 Post action
Click to initialize TinyMCE

Fill inputs with values

0 Redirect action

The URL to redirect to. See "Cheatsheet" tab for all available template tags.

0 Term action
Click to initialize TinyMCE

Fill inputs with values

0 User action
Click to initialize TinyMCE

Fill inputs with values

1 Post action
Click to initialize TinyMCE

Fill inputs with values

Apply field groups locations rules for front-end display

Whether or not to create a <form> element

Form class and id

class
id

Add class to all fields

wrapper class
input class

Whether or not to create a form submit button. Defaults to true

The text displayed on the submit button

HTML used to render the submit button.

HTML used to render the submit button loading spinner.

Whether to include a hidden input field to capture non human form submission. Defaults to true.

Whether or not to sanitize all $_POST data with the wp_kses_post() function. Defaults to true.

Whether to use the WP uploader or a basic input for image and file fields. Defaults to 'wp' Choices of 'wp' or 'basic'.

Determines element used to wrap a field. Defaults to 'div'

Determines where field labels are places in relation to fields. Defaults to 'top'.
Choices of 'top' (Above fields) or 'left' (Beside fields)

Determines where field instructions are places in relation to fields. Defaults to 'label'.
Choices of 'label' (Below labels) or 'field' (Below fields)

Override the native field groups HTML render

Extra HTML to add before the fields

Render your own customized HTML.

Extra HTML to add after the fields

Hide the general error message: "Validation failed. 1 field requires attention"

Hide the successful notice when an error has been thrown

Do not prompt user on page refresh

Choose where to display field errors

Add class to error message

Hide form on successful submission

A message displayed above the form after being redirected. See "Cheatsheet" tab for all available template tags.

HTML used to render the updated message.
If used, you have to include the following code %s to print the actual "Success message" above.

Retrieve actions output

Last Term Action
{action:term:ID}23
{action:term:post_title}Term
{action:term:admin_url}https://www.acf-extended.com/wp-admin/term.php?tag_ID=23
{action:term:permalink}https://www.acf-extended.com/taxonomy/term
See {term} for all available tags

Term Action Named my-term
{action:my-term:ID}23
{action:my-term:post_title}Term
{action:my-term:admin_url}https://www.acf-extended.com/wp-admin/term.php?tag_ID=23
{action:my-term:permalink}https://www.acf-extended.com/taxonomy/term
See {term} for all available tags

Retrieve actions output

Last User Action
{action:user:ID}1
{action:user:user_login}login
{action:user:user_email}[email protected]
{action:user:user_url}https://www.website.com
{action:user:permalink}https://www.acf-extended.com/author/johndoe
See {user} for all available tags

User Action Named my-user
{action:my-user:ID}1
{action:my-user:user_login}login
{action:my-user:user_email}[email protected]
{action:my-user:user_url}https://www.website.com
{action:my-user:permalink}https://www.acf-extended.com/author/johndoe
See {user} for all available tags

Retrieve actions output

Last Email Action
{action:email:from}Contact
{action:email:to}[email protected]
{action:email:reply_to}[email protected]
{action:email:cc}[email protected]
{action:email:bcc}[email protected]
{action:email:subject}Subject
{action:email:content}Content

Email Action Named my-email
{action:my-email:from}Contact
{action:my-email:to}[email protected]
{action:my-email:reply_to}[email protected]
{action:my-email:cc}[email protected]
{action:my-email:bcc}[email protected]
{action:my-email:subject}Subject
{action:my-email:content}Content

#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.