Use Gravity Forms to submit custom post types

In my previous post I explained how I used the Types plugin to create a new custom post type. That custom post type will be used to display a table of supported themes for my WordPress SEO plugin, and is therefor called wpseo-theme. Now the trick here is that I want users to be able to submit themes through a form.

Gravity Forms + Custom Post Type addon

By default, Gravity Forms allows you to create posts through a form. It doesn’t have support for custom post types at the moment though, in part because a wonderful plugin was already created that allows for this. This plugin, aptly named Gravity Forms + Custom Post Types can be downloaded from

Once you have both Gravity Forms and this plugin activated, you can start creating a form. The first step is to make the form fill our custom post type. We start with creating a form and dragging in a title field:

Create form with Gravity Forms

The title field can be found in the posts field section of Gravity Forms field, below the advanced fields:

Post fields in Gravity Forms

Once you’ve added this input field and given it a name, go to the advanced section of its edit block, you’ll see an option to save as post type, this has been added by the afore mentioned plugin:

title field advanced section - save as custom post type

You check the box and select the custom post type you want to use, in my case, WPSEO Themes. Now we start adding the form. We need a couple of different types of values:

  • The title: done.
  • The “description”, which will just be the body text, so you can easily drag in the Body input field.
  • An image, which should be saved as the featured image too, more on that below.
  • Several custom fields, more below too.

Adding a featured image trough the form

This is actually pretty easy: drag in an image field and click edit, you’ll see something like the screen below:

Image field - featured image

As you can see, setting the image as featured image is as easy as ticking the box. It’s wise to also ask for a description if you don’t know what’s going to be on the image. In my case, it’s a screenshot of the theme, so I won’t bother and just set the alt tag automatically.

Adding custom fields through Gravity Forms

The next step is to add the several custom fields we need. In my case I had 5, but you can have as much as you want. You start by dragging a Custom Field input into your form. Once you have that, you click edit and you select the appropriate custom field type:

Select custom field type

In this case, I’m asking for the theme URL, so I select website, but there are all sorts of options you can choose from, as you can see. Now here comes the tricky part, you need to set the name of your custom field. You should go into your Types -> Custom Fields page and check the second value below the custom field title:

Custom field details - Types plugin

That’s the name of your custom field, but you should prefix it with “wpcf-“, because that’s the Types plugin naming convention, which prevents its custom fields from clashing with other ones.

Name custom field

Of course, if you created a custom field group from already existing custom fields you don’t need to prefix the custom field name.

True / false or “boolean” input fields

Some of your custom values might be checkboxes, they’re either on or off, true or false. That’s called a boolean value in math / developers language, but for you, it’s really simple. Just create a custom field type “checkboxes”, and go into it’s settings:

Custom field type checkboxes

Be sure to check the “enable values” box and set the value to just “1”. That way, if checked, Gravity Forms will save it as value “1” and the Types plugin will “get it”.

Deciding on workflow

Now, once you’ve used the above info to finish your form, you need to decide on a workflow. On the post title field, the one whose advanced settings we used to save this input as a custom post type, we now go to the “normal” properties:

Post title - field properties

As you can see, you can set a default post author and a post status. Now in my case the author will be me in most cases, as nobody will be logged in. However, if you have enabled registration on your site, you can force people to be logged in before even being able to use this form, by going into your forms advanced settings and checking the “require user to be logged in” checkbox:

Require log-in

This allows for all sorts of workflows, find one that suits your site!


We still haven’t written a single line of code, yet we’ve already created a custom post type and created a form that allows people to submit custom post types to us.

So, one more thing to check of off the to-do list:

  1. Creating a custom post type + custom fields.
  2. Creating a form through which people can submit themes that fills this post type.
  3. Creating a browsable interface for this post type.

In my next post, I’ll explain how to use the Views plugin to create “views” for this post type and unveil the finished product!

Make Yoast SEO & Woo work together smoothly

  • Make your products stand out in Google
  • Get more buyers to your online store
  • Make products easier to find on your site
  • Have a cleaner XML sitemap & more
More info

33 Responses to Use Gravity Forms to submit custom post types

  1. Robert Jongkees
    Robert Jongkees  • 8 years ago

    You didn’t create page 3 yet?
    >> 03. Creating a browsable interface for this post type.
    Tried to find it via the search, but seems its not there yet. Would like to learn some more from your best practices etc.

  2. Ken Snyder
    Ken Snyder  • 8 years ago

    Great plugin and great write up. I’m left with one questions that I haven’t been able to answer for myself:

    1. Is there a way to get the list of possible Select values from a Custom Field (which is defined as a Select Field) and into a select box form? I’m probably just being dumb but can’t find a way to get this to work.

    I’m also quite interested to hear more from Roger on his “update” solution. Sounds like he’s got it solved but I’m a little too much of a beginner to understand his solution.

  3. Carlos
    Carlos  • 8 years ago

    I’ve been digging away at this and trying to figure out if it is possible to add the SEO fields to one of these forms? Anyone have any thoughts?

  4. Carlos
    Carlos  • 8 years ago

    LOVE IT. any way to integrate this with your SEO plugin? would be great to allow all the SEO options per page/post be available via the form.

  5. Scottie Mayman
    Scottie Mayman  • 8 years ago

    “Creating a browsable interface for this post type.”

    I’m pretty sure where you’re going, but I’d like to see the route you chose.

  6. Michael Geneles
    Michael Geneles  • 8 years ago

    Great writeup. When will you publish Part 3?

  7. David
    David  • 8 years ago

    Love this plugin and this helpful write-up.

    I am a little confused regarding posting data to custom fields. Should a list of available custom fields show up under “Custom Field Name – Existing”? I have created custom fields – they show up on the WP editor for the CPT but nothing shows up in this plugin.

    Or no I need to enter them under “New” before they will show up? If I have to enter them, and I have added them to a Custom Field Group, it sounds like I would enter them without a “wpcf” prefix?

  8. Gordon
    Gordon  • 8 years ago

    Me too. Will the final solution include search within the custom posts? Will you be using a WP archive of those posts or something else?

  9. Tony Lima
    Tony Lima  • 8 years ago

    I agree with Dave Porter — eagerly awaiting the third installment!

  10. Dave Porter
    Dave Porter  • 8 years ago

    Really looking forward to the final installment of these articles ? It’s been a while! Hope you have not forgotten?
    Cheers, Dave

  11. Megan
    Megan  • 8 years ago

    We LOVE gravity forms! Have been using on them on our website recently for a sign up form. Had to get a programmer to set them up for us but the results are amazing

  12. Macke
    Macke  • 8 years ago

    Hey, great post but I’m having a problem understanding how to display custom post types in my posts. I’m making an ad site but it’s only the body and title showing up in posts.

  13. Ed Coyne
    Ed Coyne  • 8 years ago

    Ha! I read your to-do list and the first thing that came to my mind was “VIEWS!” Then I read the next sentence.

  14. Doug Smith
    Doug Smith  • 8 years ago

    Gravity Froms and the Custom Post Types plugin have been a fantastic combination for one of the sites I run. We’ve been adding more user submitted features and it works so well to collect that information and keep it for our approval before making it live on the site.

    The one thing I don’t like is that Gravity Forms also stores a record for the entry. Any ideas on how to make it stop doing that when the data is being store in a custom post type?

    • Simon
      Simon  • 8 years ago

      Hi Doug – that’s what I also needed to do, I’ve put the code up on Pastebin (originally found via the Gravity Help forums):

      • Doug Smith
        Doug Smith  • 8 years ago

        Thanks. That did the trick after I fixed one error in the code. There is an extra right parenthesis in the add_action line. It should read:

        add_action( 'gform_post_submission', 'my_remove_entries', 10, 2 );

        • Ken Snyder
          Ken Snyder  • 8 years ago

          What are the 10 and 2 references too? Does this block all custom post submissions but leaves other submissions?

  15. Louis_Dea
    Louis_Dea  • 8 years ago

    The plugin is awesome. I also add the plugin : “Gravity Forms + Custom Post Types” which add the possibility to add also custom taxonomies which is totally awesome!

  16. Michele
    Michele  • 8 years ago

    Fantastic article!! I cannot thank you enough for turning me on to Gravity Forms it is an amazing plugin (just like yours are).

    Thank you so much again for all that you do and write I have learned so much from you.

    Warmest Regards,

  17. Kerri
    Kerri  • 8 years ago

    Thank you Joost ! I’ve been thinking of purchasing Gravity Forms for a while now and your post has helped tremendously. I appreciate all you contribute to the WP community and will be sure to use your link when it’s time to buy.

    Kind Regards,

  18. Deryk Wenaus
    Deryk Wenaus  • 8 years ago

    If only you could use gravity forms to edit an existing post in the front end, that would be incredibly useful.

    • Roger Coathup
      Roger Coathup  • 8 years ago

      We have editing working with Gravity Forms, through a fairly simple process:
      1. Embed a hidden field in your form to hold the ID of the post to edit
      2. When you display the form using gravity_form() function in your template, pre-populate the fields with the data from your post ($field_values parameter)
      3. Add a hook to gform_post_data, that extracts the ID from the form (rgpost() function) and set $post_data[“ID”] = your_post_id;

      That’s it – when GF calls the wp_insert_post it will detect that ID is set and modify the existing post, rather than creating a new one.

      • Ann Bannister
        Ann Bannister  • 8 years ago

        Hi Roger, I am fairly new to Gravity Forms and have been searching for the instructions on how to add a hook to extract information submitted from a list of categories. I do not even know how to add a hook. Can you point me in the right direction?

    • Antony
      Antony  • 8 years ago

      Hard to do the edit if the user is not logged on.
      You can use the front end editor plugin on to handle editing as an admin quickly.

  19. todd hamilton
    todd hamilton  • 8 years ago

    This write up was really helpful, thanks Joost!

  20. Chuck Reynolds
    Chuck Reynolds  • 8 years ago

    I’ve used this a few times and it works well. Where I ran into issues is if my CPT doesn’t use the title field. I have custom metaboxes for everything but the CPT must have the default title field for this to work. Not the end of the world but that dependency has been an issue and probably will be in the future for customized sites.

  21. Rajesh Namase
    Rajesh Namase  • 8 years ago

    Gravity is very good paid plugin, with addition of this plugin it simply rocks. Amazing.

  22. Simon
    Simon  • 8 years ago

    This plugin is a fantastic addition to Gravity Forms – I’ve combined it with the PayPal add-on for creating a pretty powerful event registration system.

    The form populates a (non-public) post type of “attendee” with various custom fields & taxonomies for address, email, ticket type, accommodation, etc., so the site administrator can for example easily see a list of all attendees who’ve bought a premium ticket.

    Works like a dream and took me less than 3 hours to build! The only coding was for the template and a CSV export function.

    • Paul
      Paul  • 8 years ago

      SImon – would you care to share a link to that event registration site? I currently look after a site I built for a client which does exactly that, however, I’d love to be able to rewrite it using Gravity Forms…

      • Simon
        Simon  • 8 years ago

        Sorry,I can’t give out the URL until it goes live because the event is not publicly announced yet, probably in 2-3wks. You wouldn’t actually see anything from the front-end anyway, just the registration form, all the magic happens behind the scenes :-)

  23. Rev. Voodoo
    Rev. Voodoo  • 8 years ago

    Man, where were you 6 months ago!! lol. I was setting up a user oriented wine rating site. I did all of this by code originally. The multiple detailed front end posting forms were hell for a non-experienced coder hack like myself. I did finally switch over to Gravity Forms. But wow, the process you are walking us through is pretty much what I had to stumble through the hard way. Thanks for a valuable series!

    • Brandon
      Brandon  • 8 years ago

      Rev. Voodoo,

      Was wondering if your Wine Rating site is “live”? Would love to check it out!

      Thanks – Brandon R.

      • Steffy
        Steffy  • 8 years ago

        Me too I would be interrested since I have planned to do a rating site too.. I’m very interrested in your rating systeme choice
        thank you in advance