Title: Editing posts
Last modified: August 22, 2016

---

# Editing posts

 *  Resolved [deserteagle](https://wordpress.org/support/users/deserteagle/)
 * (@deserteagle)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/editing-posts-11/)
 * Once the post is submitted, how can I view or edit it? It shows up in the admin
   dashboard, but only displays the CF7 shortcode.
 * Thanks for the help, and keep up the awesome work!
 * [https://wordpress.org/plugins/form-to-post/](https://wordpress.org/plugins/form-to-post/)

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

 *  Plugin Author [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * (@msimpson)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/editing-posts-11/#post-5497375)
 * After a post is created via a form, the post would be shown on a site just like
   a post you create manually. You should also see it under “Posts” in WP admin 
   where you can edit it.
 *  Thread Starter [deserteagle](https://wordpress.org/support/users/deserteagle/)
 * (@deserteagle)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/editing-posts-11/#post-5497444)
 * It shows up, but again, only displays the shortcode in the WP admin… and going
   back to that post on the front-end shows nothing.
 *  Plugin Author [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * (@msimpson)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/editing-posts-11/#post-5497456)
 * I’m totally confused whether you are talking about a post with the form or some
   shortcode or the post created by the form.
 *  Thread Starter [deserteagle](https://wordpress.org/support/users/deserteagle/)
 * (@deserteagle)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/editing-posts-11/#post-5497468)
 * No worries, I understand. Took me a while to figure it out myself, so here goes.
 * The page shows the form just fine: [http://imgur.com/ueFykh4](http://imgur.com/ueFykh4)
 * The form submits and becomes a post: [http://imgur.com/GByRsil](http://imgur.com/GByRsil)
 * The post appears in the admin: [http://imgur.com/hoeK0GP](http://imgur.com/hoeK0GP)
 * But the post itself does not show what I typed in: [http://imgur.com/JfAwXtS](http://imgur.com/JfAwXtS)
 * Instead it shows the shortcode I put in the page to get the contact form to show:
   [http://imgur.com/r1oxL5z](http://imgur.com/r1oxL5z)
 *  Plugin Author [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * (@msimpson)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/editing-posts-11/#post-5497470)
 * That helps. Weird that the short code is there.
 * Would you paste in here your form definition? (Please format as code)
 *  Thread Starter [deserteagle](https://wordpress.org/support/users/deserteagle/)
 * (@deserteagle)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/editing-posts-11/#post-5497472)
 *     ```
       [hidden post_title]
       [hidden post_content "application"]
       [hidden post_category_name "Duct Seal"]
       [hidden ID]
   
       <p>Equipment Make*
       [text* text-227 id:make]</p>
       <p>Start-up Date*
       [text* text-8 id:startupdate]</p>
       <p>Model #*
       [text* text-246 id:condensermodelnumber]</p>
   
       <p>[submit "Send"]</p>
       ```
   
 * Here are the modifications I did to FormToPost_Plugin.php
 *     ```
       $post = array(
       #            'post_status' => 'publish',
                   'post_status' => 'pending',                              # initial rebate application status
                   'post_type' => 'post',
                   'post_category' => array(0)
               );
       ```
   
 * And here are the modifications I did to the hidden.php of Contact Form Module
 *     ```
       global $post;
       	date_default_timezone_set(get_option('timezone_string'));				# sets the timezone used from the wordpress selection
       	$rebate_time = date("m/d/Y @ h:ia");													# rebate application timestamp
       	$rebate_type = get_the_title();
       	if(is_object($post)) {
   
       		switch($sanitized_name) {
       			case 'post_title':
       			case 'post-title':
       				#$value = $post->post_title;
       				$value = $rebate_type." submitted on " .$rebate_time;                        # rebate application title
       				break;
       ```
   
 *  Plugin Author [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * (@msimpson)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/editing-posts-11/#post-5497477)
 * Ok, I was a little confused, but I now understand that [http://imgur.com/r1oxL5z](http://imgur.com/r1oxL5z)
   is the view of the page with the form, not the post listed in [http://imgur.com/hoeK0GP](http://imgur.com/hoeK0GP)
 * I assume if you open [http://imgur.com/hoeK0GP](http://imgur.com/hoeK0GP) then
   you see an empty post. This is because there is nothing in the post_content field.
   Whatever is in post_content in the form becomes the content of the post.
 * If you want to get the other form values (make, startdate, etc.) then you need
   to find a way of copying that information into the post_content field. You can
   try to do this (1) on the front end using some Javascript prior to submit or (
   2) register a hook in CF7 or (3) modify FormToPost_Plugin.php to do it. I would
   recommend (2).
 * In fact I think you can avoid changing code in hidden.php and my plugin by using
   a CF7 hook instead. If you modify a plugin, then you loose your changes if you
   update the plugin. Using a hook is a better way to go.
 * I’ll suggest my own [Add Actions and Filters](https://wordpress.org/plugins/add-actions-and-filters/)
   plugin which gives you an admin page to place PHP code in. Then I would put code
   like this leveraging CF7’s wpcf7_posted_data hook (I haven’t tested it! Just 
   giving you an idea).
 *     ```
       function set_form_to_post_values($posted_data) {
           $posted_data['post_status'] = 'pending';
   
           $posted_data['post_content'] = 'Make:' . $posted_data['text-227] . '<br/>Start Update:' . $posted_data['text-8'] . '<br/>Model:' . $posted_data['text-246'];
   
           date_default_timezone_set(get_option('timezone_string'));
           $rebate_time = date("m/d/Y @ h:ia");
           // Actually get_the_title() won't work here in the hook callback functions...
           // ... might try adding javascript to page to set the value of a hidden field
           // which could be accessed here.
           // see http://stackoverflow.com/questions/18023030/how-to-get-post-title-by-javascript-before-submission
           $rebate_type = 'TBD'; //get_the_title();
           $posted_data['post_title'] = $rebate_type." submitted on " .$rebate_time; 
   
           return $posted_data;
       }
   
       add_action('wpcf7_posted_data', 'set_form_to_post_values');
       ```
   
 *  Thread Starter [deserteagle](https://wordpress.org/support/users/deserteagle/)
 * (@deserteagle)
 * [11 years, 6 months ago](https://wordpress.org/support/topic/editing-posts-11/#post-5497562)
 * Thank you so much! Your Add Actions and Filters plugin ROCKS, by the way!

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

The topic ‘Editing posts’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/form-to-post.svg)
 * [Form to Post](https://wordpress.org/plugins/form-to-post/)
 * [Support Threads](https://wordpress.org/support/plugin/form-to-post/)
 * [Active Topics](https://wordpress.org/support/plugin/form-to-post/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/form-to-post/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/form-to-post/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [deserteagle](https://wordpress.org/support/users/deserteagle/)
 * Last activity: [11 years, 6 months ago](https://wordpress.org/support/topic/editing-posts-11/#post-5497562)
 * Status: resolved