Support

Account

Home Forums Front-end Issues How do you create post_title from another field(s) in ACF Pro? Reply To: How do you create post_title from another field(s) in ACF Pro?

  • create a new field group in functions.php then add it in your template code like this

    // in functions.php //

    
    add_action('acf/register_fields', 'register_field_group');
    
    if(function_exists("register_field_group"))
    {
        register_field_group(array (
            'id' => 'acf_form-post-title',
            'title' => 'Form Post Title',
            'fields' => array (
                array (
                    'key' => 'field_25',
                    'label' => 'Title',
                    'name' => 'form_post_title',
                    'type' => 'text',
                    'default_value' => '',
                    'formatting' => 'html',
                ),
            ),
            'location' => array (
                array (
                    array (
                        'param' => 'post_type',
                        'operator' => '==',
                        'value' => 'course',
                        'order_no' => 0,
                        'group_no' => 0,
                    ),
                ),
            ),
            'options' => array (
                'position' => 'normal',
                'layout' => 'no_box',
                'hide_on_screen' => array (
                ),
            ),
            'menu_order' => -2,
        ));
    }
    
    

    // in you template page //

    
    acf_form(array(
       'post_id' => 'new_post',
       'new_post' => array(
          'post_type' => 'custom',
          'post_status' => 'draft',
          '
       ),
       'field_groups'   => array(49, 'acf_form-post-title'),
       'submit_value'   => 'Submit',
    ));