Title: Set Custom Post Type
Last modified: August 21, 2016

---

# Set Custom Post Type

 *  [Dewey Bushaw](https://wordpress.org/support/users/styledev/)
 * (@styledev)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/set-custom-post-type/)
 * I am either missing something of something is broken. Where do I set what Custom
   Post Type the form will add/edit?
 * [http://parapxl.com/wp/gf-update-post-post_title.jpg](http://parapxl.com/wp/gf-update-post-post_title.jpg)
 * [http://wordpress.org/plugins/gravity-forms-update-post/](http://wordpress.org/plugins/gravity-forms-update-post/)

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

 *  [Jupitercow](https://wordpress.org/support/users/jcow/)
 * (@jcow)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/set-custom-post-type/#post-4550046)
 * If you want to use custom post types, you have to use the “Gravity Forms + Custom
   Post Types” plugin:
    [http://wordpress.org/plugins/gravity-forms-custom-post-types/](http://wordpress.org/plugins/gravity-forms-custom-post-types/)
 * This plugin only allows you to update posts, that plugin expands your abilities
   to include custom post types and custom taxonomies.
 *  Thread Starter [Dewey Bushaw](https://wordpress.org/support/users/styledev/)
 * (@styledev)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/set-custom-post-type/#post-4550047)
 * What you say is true but the description for this plugin states: “Update or Delete
   Posts, Pages or **Custom Post Types** with Gravity Forms”
 *  [Jupitercow](https://wordpress.org/support/users/jcow/)
 * (@jcow)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/set-custom-post-type/#post-4550055)
 * This plugin can update custom post types, but Gravity Forms doesn’t support them
   without that plugin.
 * So you are required to have the custom post type plugin in order to use custom
   post types with gravity forms.
 *  Thread Starter [Dewey Bushaw](https://wordpress.org/support/users/styledev/)
 * (@styledev)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/set-custom-post-type/#post-4550056)
 * I think that this requirement should be added to the Installation and/or FAQ 
   page.
 *  [Jupitercow](https://wordpress.org/support/users/jcow/)
 * (@jcow)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/set-custom-post-type/#post-4550066)
 * It would probably be good to mention, I agree. Again, though, this is a requirement
   of Gravity Forms, not this plugin. This plugin uses the forms that are provided,
   and Gravity Forms can’t provide a custom post type form out of the box. So another
   plugin is needed. Just like Gravity Forms can’t edit posts out of the box. So
   another plugin is needed.
 *  Thread Starter [Dewey Bushaw](https://wordpress.org/support/users/styledev/)
 * (@styledev)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/set-custom-post-type/#post-4550068)
 * I see what you are saying but I would counter that one would be led to believe
   that you wouldn’t need any other plugin other than gravity forms and this one
   to edit a custom post type unless they already knew that you need that other 
   plugin.
 *  [Jupitercow](https://wordpress.org/support/users/jcow/)
 * (@jcow)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/set-custom-post-type/#post-4550072)
 * Which is why it would be good to mention. I don’t disagree. This isn’t my plugin,
   and this plugin hasn’t been updated in a long time. I have a replacement for 
   it that I am working on getting into the WordPress repo. It is currently here:
   [https://bitbucket.org/jupitercow/gravity-forms-update-post](https://bitbucket.org/jupitercow/gravity-forms-update-post)
 * When I get it in, I will make sure it is clearer.
 *  Thread Starter [Dewey Bushaw](https://wordpress.org/support/users/styledev/)
 * (@styledev)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/set-custom-post-type/#post-4550080)
 * Cool.
 *  [mandalatv](https://wordpress.org/support/users/mandalatv/)
 * (@mandalatv)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/set-custom-post-type/#post-4550099)
 * Hey jcow, I’m actually looking at your in-progress replacement, particularly 
   because I really like the direction you’re taking.
 * One question–is there a way to override the post id in a hook after submission?
   I’m building a form that finds the custom post via a custom field then returns
   the post id. It seems like all the solutions out there either append a GET or
   hidden field (via smartcode).
 * I’ve tried hijacking the value in gform_post_data and in the gform_validation
   with no luck.
 *  [Jupitercow](https://wordpress.org/support/users/jcow/)
 * (@jcow)
 * [12 years ago](https://wordpress.org/support/topic/set-custom-post-type/#post-4550104)
 * This is still Gravity Forms, so you can use the Gravity Forms hooks. Doesn’t 
   gform_after_submission work?
 * [http://www.gravityhelp.com/documentation/page/Gform_after_submission](http://www.gravityhelp.com/documentation/page/Gform_after_submission)
 * In tutorials, they are always suggesting sending dates and user_ids and all kinds
   of crap through the forms, when you can usually just hook in there and get current
   user, or the current date and add them as needed. At least when you are working
   with post creation or update.
 *  [mandalatv](https://wordpress.org/support/users/mandalatv/)
 * (@mandalatv)
 * [12 years ago](https://wordpress.org/support/topic/set-custom-post-type/#post-4550105)
 * I don’t think I explored that hook since it occurs after entry creation.
 * I had a lot of inconsistent results (possible due to local caching and/or using
   the [custom post type plugin](http://wordpress.org/plugins/gravity-forms-custom-post-types/)).
   I actually gave up on this a few times. Ultimately, I got it to work doing a 
   few things:
 * I assigned the class instantiation to a variable by adding the following lines
   at L1101 of gravityforms-update-post.php:
 *     ```
       $gform_update_post = new gform_update_post();
       $gform_update_post::init();
       ```
   
 * I then referenced it in my custom functions.php and had it assigned to the wp
   hook:
 *     ```
       global $gform_update_post;
       add_action( 'wp', array($gform_update_post, 'init'), 100 );
       ```
   
 * In my validation script, I loop through custom posts, find the matching field,
   then retrieve its $post_id. With the global instance I then called:
 *     ```
       $gform_update_post::get_post_object($post_id);
       ```
   
 * Lastly, I added a post_id via a shortcode on the page containing the form. I 
   found that omitting the variable via query string or shortcode made it fail.
 *     ```
       [gform_update_post post_id=1]
       ```
   
 * I suppose this could be optimized further, but I’ve easily surpassed the time
   I allocated toward this and am simply grateful that it’s now working.

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

The topic ‘Set Custom Post Type’ 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/)

## Tags

 * [cpt](https://wordpress.org/support/topic-tag/cpt/)
 * [custom post type](https://wordpress.org/support/topic-tag/custom-post-type/)

 * 11 replies
 * 3 participants
 * Last reply from: [mandalatv](https://wordpress.org/support/users/mandalatv/)
 * Last activity: [12 years ago](https://wordpress.org/support/topic/set-custom-post-type/#post-4550105)
 * Status: not resolved