Gravity Forms + Custom Post Types WordPress Plugin

In this post I would like to introduce my new WordPress plugin called Gravity Forms + Custom Post Types. Lets not beat around the bush and get to the nitty gritty:

What is it?

  1. It works as an “add on” to the already awesome Gravity Forms Plugin.
  2. It maps a form to a WordPress custom post type.
  3. It also allows you to include WordPress custom taxonomies within a form. (Works with the Drop Downs, Multiple Choice or Checkbox fields)

Show Me The End Result

Here is an example form linked to a custom post type of ‘movies’ and includes 3 fields linking to different custom taxonomies.

A Little History

I have been using Gravity Forms for quite a while now on some client sites. It is simply the best forms plugins for WordPress. Period. And I can honestly say this because I have tried most of the free and premium form builders out there.

In Gravity Forms, one of the cool features is the ability for a form to create a post when it is submitted. This is their explanation : “Post Fields allow you to add fields to your form that create Post Drafts in WordPress from the submitted data.”  Think of these ‘post fields’ as the link to the values within a post. For example, you add a ‘post title’ field and when the form is submitted, a post is created behind the scenes, with a title of whatever was submitted. Other types of post fields are Body, Excerpt, Tags, Category, Image and custom field.

So Why Build A Plugin?

For common scenarios this plugin is not needed, but for more complex cases, there is a gap that needs to be filled : the post that is created is always of type POST. I wanted a nice and simple (without any extra coding) way to tell my form to create a custom post type. I also wanted to include a custom taxonomy in the form and link the selected taxonomy to the created custom post type.

Show Me How!

There are 2 ways to ‘link’ a form to a custom post type, and it depends on the version of Gravity Forms you are using. For Gravity Forms v1.4.5 (the current version at the time of writing this post), you have to supply CSS class names to map everything. In the newer, still in beta version, the Gravity Forms code has come a long way, and new hooks allow for tighter integration. In the beta of v1.5 you simply select the post type or taxonomy from a dropdown list under the advanced tab. Awesome!

Map a Form to a Custom Post Type

Link a Field to a Custom Taxonomy

What Next?