Title: Edit previously submitted posts
Last modified: May 3, 2018

---

# Edit previously submitted posts

 *  Resolved [andreadrago](https://wordpress.org/support/users/andreadrago/)
 * (@andreadrago)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/edit-previously-submitted-posts/)
 * Hi Aurovrata,
    I really like your plugin, but I was wondering if it has a built-
   in functionality to edit an axisting post that was previously submitted, for 
   example by passing an ID along with the form. If this is not possible, I already
   have a workaround, but in this situation i would need to avoid the creation of
   a new post from within a filter (i will map an hidden ID field, then check its
   value using a filter and do the update by myself). Is there a way to stop the
   creation?
 * Thank you very much in advance!

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

 *  Plugin Author [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * (@aurovrata)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/edit-previously-submitted-posts/#post-10242427)
 * >  I was wondering if it has a built-in functionality to edit an axisting post
   > that was previously submitted,
 * yes, this is possible. You have to know a few things first,
 * – A mapped post that has been saved as a draft is reloaded automatically for 
   the same author/logged in user.
    – A submitted post, as opposed to a saved/draft
   one, has a its meta-field `_cf7_2_post_form_submitted` set to ‘yes’, and this
   controls wheather or not an authors’ post is to be reloaded when the form is 
   being displayed for the current user.
 * However, you can override all this by actually hooking into the post loading 
   process prior to displaying the form. The process used [get_posts](https://codex.wordpress.org/Template_Tags/get_posts)
   to retrieve a post, and takes the first post it finds.
 *     ```
       add_filter('cf7_2_post_filter_user_draft_form_query', 'custom_post_query',10,2);
       function custom_post_query($query_args, $post_type){
         if('my-mapped-post' === $post_type){ //check for your mapped post type.
           //set up your custom $query_args 
         }
         return $query_args;
       }
       ```
   
 *  Thread Starter [andreadrago](https://wordpress.org/support/users/andreadrago/)
 * (@andreadrago)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/edit-previously-submitted-posts/#post-10242496)
 * Hi Arovrata,
    thank you very much for the prompt response. I’ll go with the filter,
   but I have some things that may cause some problems: Since the filter is shared
   by all forms throughout the website, and I have two different forms that are 
   associated with the same Custom Post Type, is there a way to get the form id 
   within that filter? That way I could choose when to load a post or not. If in
   some situation I don’t want a post to be loaded, what should I return from the
   function?
 * Thank you again for your support
 *  Plugin Author [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * (@aurovrata)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/edit-previously-submitted-posts/#post-10242802)
 * > is there a way to get the form id within that filter
 * Indeed, with v2 unique form keys were introduced to make forms more portable 
   between different WP installations, but some of these older hooks were not updated.
 * I just released v3.8.1, with the key parameter added to the filter. See FAQ #
   23 for details.
 *  Thread Starter [andreadrago](https://wordpress.org/support/users/andreadrago/)
 * (@andreadrago)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/edit-previously-submitted-posts/#post-10242996)
 * Thank you very much, this is exactly what I needed 🙂
 * Have a good day!
 *  Plugin Author [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * (@aurovrata)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/edit-previously-submitted-posts/#post-10243406)
 * your’re wc, do leave a review!

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

The topic ‘Edit previously submitted posts’ is closed to new replies.

 * ![](https://ps.w.org/post-my-contact-form-7/assets/icon-256x256.png?rev=1985682)
 * [Post My CF7 Form](https://wordpress.org/plugins/post-my-contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/post-my-contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/post-my-contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/post-my-contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/post-my-contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/post-my-contact-form-7/reviews/)

## Tags

 * [edit](https://wordpress.org/support/topic-tag/edit/)

 * 5 replies
 * 2 participants
 * Last reply from: [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * Last activity: [8 years, 1 month ago](https://wordpress.org/support/topic/edit-previously-submitted-posts/#post-10243406)
 * Status: resolved