Title: Form to post
Last modified: August 31, 2016

---

# Form to post

 *  Resolved [drharoonashraf](https://wordpress.org/support/users/drharoonashraf/)
 * (@drharoonashraf)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/form-to-post-3/)
 * I want to use a form to create posts from front end. I tried form to post with
   cf7. But in form to post one field can be identified as post title and another
   one as content. I want a 10 or more fields to be converted into post.
    Can it
   be done?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * (@msimpson)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/form-to-post-3/#post-7170873)
 * The code doesn’t currently support it. I supposed I should but in a hook where
   you can add your own code to consolidate different fields into the post content.
   LMK if you are interested.
 *  Thread Starter [drharoonashraf](https://wordpress.org/support/users/drharoonashraf/)
 * (@drharoonashraf)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/form-to-post-3/#post-7170951)
 * I am not a programmer and I don’t know the codes. But I am willing to stretch
   myself if someone guides me. Please Simpson…
 *  [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * (@msimpson)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/form-to-post-3/#post-7171035)
 * Update to version 0.10 when it shows a available.
 * You’ll need to install [Add Shortcodes Actions And Filters](https://wordpress.org/plugins/add-actions-and-filters/)
   plugin.
 * You will need to modify the below example to suite your needs.
 * Example: you don’t have a “post-content” or “post-title” field in your form, 
   but you want to set those values as a combination of values from other form fields.
   In this simply example, our form has field “your-name” and “your-email”.
 * The hook is used to create the “post-content” or “post-title” fields to be text
   with the value of fields “your-name” and “your-email” embedded in them.
 *     ```
       function f2p_consolidate_fields( $form_data ) { // change the function name as needed
           $form_title = 'F2P With Hook Example'; // Change this to your form name
           if ($form_data->title = $form_title) {
   
               // Next line sets the post_title value - change to match how you want the text
               $form_data->posted_data['post_title'] = "Post from {$form_data->posted_data['your-name']}";
   
               // Next line sets the post_content value - change to match how you want the text
               $form_data->posted_data['post_content'] =
                   "This is a post from {$form_data->posted_data['your-name']} with email {$form_data->posted_data['your-email']}";
           }
           return $form_data;
       }
       add_filter( 'form_to_post_form_data', 'f2p_consolidate_fields', 10, 1 ); // make sure the function name matches above
       ```
   
 *  Thread Starter [drharoonashraf](https://wordpress.org/support/users/drharoonashraf/)
 * (@drharoonashraf)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/form-to-post-3/#post-7171084)
 * Thanks,it works.. wonderfully…

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Form to post’ is closed to new replies.

## Tags

 * [front end posting](https://wordpress.org/support/topic-tag/front-end-posting/)

 * 4 replies
 * 2 participants
 * Last reply from: [drharoonashraf](https://wordpress.org/support/users/drharoonashraf/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/form-to-post-3/#post-7171084)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
