Title: [Plugin: Gravity Forms &#8211; Update Post] pass post ID within shortcode?
Last modified: August 20, 2016

---

# [Plugin: Gravity Forms – Update Post] pass post ID within shortcode?

 *  [Brandon Kraft](https://wordpress.org/support/users/kraftbj/)
 * (@kraftbj)
 * Code Wrangler
 * [13 years, 8 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-update-post-pass-post-id-within-shortcode/)
 * Hi,
 * I’m trying to use this plugin within the context of a shortcode. (I’m using a
   page template to conditionally show the form and other content based on the role
   of the current user).
 * Can I do this within the typical Gravity Forms shortcode, or do I need to filter
   something in my function.
 * [http://wordpress.org/extend/plugins/gravity-forms-update-post/](http://wordpress.org/extend/plugins/gravity-forms-update-post/)

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

 *  [srumery](https://wordpress.org/support/users/srumery/)
 * (@srumery)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-update-post-pass-post-id-within-shortcode/#post-3074714)
 * I’m looking for the answer to this as well. Not by using a shortcode but by passing
   the post id directly from the page template. I have not found the proper solution
   yet. Any luck on your end?
 *  [Jupitercow](https://wordpress.org/support/users/jcow/)
 * (@jcow)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-update-post-pass-post-id-within-shortcode/#post-3074731)
 * I don’t have a short code, but I did add a function to interface with the plugin
   so that I could add the post id through php instead of with a GET variable. It
   would be used to create a short code.
 * This is my update:
 * [Overview](https://bitbucket.org/jupitercow/gravity-forms-update-post/overview)
   | [Download](https://bitbucket.org/jupitercow/gravity-forms-update-post/get/master.zip)
 * This is still being tested by me, but it is working for what I need so far. I
   needed to remove GET variable dependancy and to be able to update files. The 
   file part isn’t very graceful, but it is working.
 *  [myhero](https://wordpress.org/support/users/myhero/)
 * (@myhero)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-update-post-pass-post-id-within-shortcode/#post-3074746)
 * hi jcow,
 * Thanks for your contribution.
 * I’ve downloaded your update and replaced the original with yours.
 * and added the code given below to my functions.php.
 *     ```
       add_filter( 'gform_update_post_settings', 'custom_gform_update_post_settings' );
   
       function custom_gform_update_post_settings( $settings )
       {
           $settings['request_id'] = 'edit_id';
           return $settings;
       }
       ```
   
 * But I cannot get it setup, what would I need to add/change/remove in order to
   get this to work?
 *  [Jupitercow](https://wordpress.org/support/users/jcow/)
 * (@jcow)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-update-post-pass-post-id-within-shortcode/#post-3074747)
 * The setting you used isn’t very important.
 * If you want to have a form edit a post, you need to pass that post’s id to the
   form using one of two methods. Either add the post id to the url using the GET
   variable set up by this plugin “gform_post_id” or with the updated version of
   the plugin, you can pass the post id through a function instead.
 * Example 1, url for the current page:
    `http://example.com/path/to/edit/page/?
   gform_post_id=24`
 * Example 2, in your page template:
 *     ```
       gravityforms_update_post('setup_form', 24);
       gravity_form(1);
       ```
   
 * The code you added to functions.php will simply change `gform_post_id` to `edit_id`.
 * So after adding that to your functiions.php, you would use:
    `http://example.
   com/path/to/edit/page/?edit_id=24` instead of: `http://example.com/path/to/edit/
   page/?gform_post_id=24`
 *  [wpoo](https://wordpress.org/support/users/wpoo/)
 * (@wpoo)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-update-post-pass-post-id-within-shortcode/#post-3074748)
 * Using
 *     ```
       gravityforms_update_post('setup_form', 24);
       gravity_form(1);
       ```
   
 * (24 = the post’s id you want to update, 1 = the form’s id)
    a third user will
   not be able to change the desired post id by adding `/?gform_post_id=1` to the
   url (in order he wants to edit the post with id=1). That’s a good point and big
   improvement by jcow
 * _btw jcow,_
 * I don’t want to be rude or impolite but I do not know if you noticed the issue
   on [https://bitbucket.org/jupitercow/gravity-forms-update-post/issue/1/previously-uploaded-file](https://bitbucket.org/jupitercow/gravity-forms-update-post/issue/1/previously-uploaded-file)
   that I added.
 * I don’t get how to..: **[…]It also keeps the file from being removed from the
   field on save when nothing new was added.[…]**
 * Could you specify the feature’s setup?
 *  [Jupitercow](https://wordpress.org/support/users/jcow/)
 * (@jcow)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-update-post-pass-post-id-within-shortcode/#post-3074749)
 * It has been a while since I looked at that, I need a few minutes to review it.
   Hopefully that will happen to tomorrow, but feel free to ping me, if you don’t
   hear anything.
 *  [wpoo](https://wordpress.org/support/users/wpoo/)
 * (@wpoo)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-update-post-pass-post-id-within-shortcode/#post-3074750)
 * That’d be great to see! Thank you
 *  [myhero](https://wordpress.org/support/users/myhero/)
 * (@myhero)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-update-post-pass-post-id-within-shortcode/#post-3074751)
 * Hi jcow thanks for getting back to me! and thanks for the input wpoo.
 * Excuse my ignorance but will I have to setup 2 separate forms one for the post
   submission and another for editing the post or can I setup one form that will
   be able to do both functions?
 * Thank you
 *  [myhero](https://wordpress.org/support/users/myhero/)
 * (@myhero)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-update-post-pass-post-id-within-shortcode/#post-3074752)
 * This is what I want to do:
 * – Users must submit my form (from their dashboard) which will in turn submit 
   a post
    – The user must be able to edit the same post using the same form on 
   the dashboard
 * If multiple users submit the same form from their dashboard, will the post ID
   be unique for each post?
 * From the code:
 *     ```
       gravityforms_update_post('setup_form', 24);
       gravity_form(1);
       ```
   
 * Where 24 is the Post ID and (1) is the from ID. It seems that this is a fixed
   post ID that would link to one post only, or am I mistaken, will it support multiple
   posts from different users?
 * Am I able to achieve this using this plugin? Or will custom work be needed?
 *  [cynarad](https://wordpress.org/support/users/cynarad/)
 * (@cynarad)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-update-post-pass-post-id-within-shortcode/#post-3074753)
 * When I use the function call “gravityforms_update_post(‘setup_form’, $post_id);”
   to pass the post id, I receive an Error 500.
 * The debug log says: PHP Fatal error: Call to undefined function gravityforms_update_post().
 * Any idea why this function can’t be found??
 * I am using wordpress 3.6.
 *  [myhero](https://wordpress.org/support/users/myhero/)
 * (@myhero)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-update-post-pass-post-id-within-shortcode/#post-3074754)
 * cynarad, have you managed to get yours setup?
 *  [cynarad](https://wordpress.org/support/users/cynarad/)
 * (@cynarad)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-update-post-pass-post-id-within-shortcode/#post-3074755)
 * No, I still get the message “PHP Fatal error: Call to undefined function gravityforms_update_post()”
 *  [Jupitercow](https://wordpress.org/support/users/jcow/)
 * (@jcow)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-update-post-pass-post-id-within-shortcode/#post-3074756)
 * There was definitely a bug before. The previous was version was a really quick
   fix to get it working for me, since the plugin hasn’t been updated in a long 
   time and appears to be orphaned.
 * In the past couple weeks, I rewrote the whole thing. See the new write up for
   a better explanation:
    [https://bitbucket.org/jupitercow/gravity-forms-update-post](https://bitbucket.org/jupitercow/gravity-forms-update-post)
 * Let me know what issues you come upon in the issues system on bitbucket, since
   this plugin is really completely different than the plugin here, there i no reason
   to try and support it here currently.
 * I will work on getting these updates into the WordPress plugin repository in 
   the future.
 *  [Jupitercow](https://wordpress.org/support/users/jcow/)
 * (@jcow)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-update-post-pass-post-id-within-shortcode/#post-3074757)
 * The new version also DOES have a shortcode. It… isn’t ideal. You have to add 
   an extra short code in front of the gravity form shortcode, but it is a shortcode…

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

The topic ‘[Plugin: Gravity Forms – Update Post] pass post ID within shortcode?’
is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/gravity-forms-update-post_68a432.
   svg)
 * [Gravity Forms - Update Post](https://wordpress.org/plugins/gravity-forms-update-post/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gravity-forms-update-post/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gravity-forms-update-post/)
 * [Active Topics](https://wordpress.org/support/plugin/gravity-forms-update-post/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gravity-forms-update-post/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gravity-forms-update-post/reviews/)

 * 14 replies
 * 6 participants
 * Last reply from: [Jupitercow](https://wordpress.org/support/users/jcow/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/plugin-gravity-forms-update-post-pass-post-id-within-shortcode/#post-3074757)
 * Status: not resolved