Use Gravity Forms to Create User-Submitted Posts

The concept is pretty simple. Using Gravity Forms “Post Fields” you can create a form which generates a post when it is submitted. All you have to do is add the desired post fields to your form. When the form is submitted, Gravity Forms will check if any post fields exist on the form and if so, generate a fresh new post based on those post fields!

Before we get too much further into this, I’d really recommend checking out the basic Gravity Forms post creation demo. If you’re new to Gravity Forms this will give you a better idea of what to expect and some context for the rest of this tutorial.

Gravity Forms Post Features

This tutorial will cover each Post Field and some of the cool features each field has to offer. Here is a quick list of post-related functionality Gravity Forms can handle right out of the box:

  1. Set the Post Title
  2. Set the Post Body/Content
  3. Set the Post Excerpt
  4. Set the Post Category (GF v1.6.3 adds support for setting multiple categories!)
  5. Set Post Tags
  6. Upload Images to the Post Gallery
  7. Set the Featured Image (aka, “Post Thumbnail”)
  8. Create custom fields for the post
  9. Set the default Post Status (“Draft”, “Pending Review” or “Published”)
  10. Set the default Post Author
  11. Set the default Post Format (ie “Standard”, “Link”, “Gallery”, “Quote”, etc)

Not bad, huh? You can use this list to get more information on features that interest you OR if your thirst for Gravity Forms knowledge is simply unquenchable, I suggest reading from top to bottom.

One thing Gravity Forms does not currently support is creating custom post types; however, there is a handy dandy third-party Gravity Forms add-on that allows you to create posts for custom post types with Gravity Forms available for free in the WordPress.org repository. It’s called Gravity Forms + Custom Post Types.

1. Setting the Post Title

Adding a Post Title field to your form will allow the user submitting the form to specify the title of the post. The Post Title field is also where you will manage the default Post Status, Post Author and Post Format of the created post. We’ll go into each of those in more detail later.

It is important to note that you can actually set the default Post Status, Post Author, Post Format from the Post Body and Post Excerpt fields as well. Be aware that these settings are all “linked” and changing one setting (the Post Status, for example) on one field will update the setting on all fields. Think of them as “form settings” managed on a field level.

One of the really neat features of the Post Title field is the ability to specify a “content template”. Enabling this option will allow you to use merge tags to populate the title with dynamic values. When might you want to do this? How about if you have a Post Category field on your form. When submitted, you want to append that selected category name before the submitted post title. Here’s how that might look:

Post Title Content Template Setting

2. Setting the Post Body/Content

Adding a Post Body field to your form will allow the user submitting the form to specify the content of the post. Like the Post Title field, this field also provides options for managing the default Post Status, Post Author and Post Format of the created post.

Also like the Post Title field, the Post Body field provides the option to create a content template. It is with the Post Body field that the content template can really shine! The most obvious (and arguably the most useful) benefit is being able to insert submitted Post Images along side the submitted post content. I’ve implemented this functionality in the demo here. Here is the actual configuration I’m using to achieve the effect:

Post Body Content Template Setting

You’ll notice I’m using a pretty fancy merge tag to display the medium sized featured image to the right of the post content. Don’t worry! You don’t have to learn all that merge tag syntax. When you select a Post Image field from the merge tag drop down, a new drop down will appear with a full list of size and alignment options!

Post Image Merge Tag Options

3. Setting the Post Excerpt

Adding a Post Excerpt field to your form will allow the user submitting the form to specify the excerpt content. Like the Post Title and Post Body fields, you will be able to specify the Post Status and Post Author from this field.

4. Setting the Post Category

Adding a Post Category field to your form will allow the user submitting the form to specify which category their post should be filed in. The Post Category field not only allows you to specify which categories should be available in the field, it also provides an option to display the field as one of the following field types: Drop Down, Checkboxes, Radio Buttons, and Multi Select. Selecting “Checkboxes” or “Multi Select” will allow users to select multiple categories to file their post in! This is relatively new functionality available in GF v1.6.3.

Post Category Field Settings

Feel free to add multiple Post Category fields on the same form. Categories from different Post Category fields will be consolidated and applied when the post is created.

5. Setting the Post Tags

Adding a Post Tags field to your form will allow the user submitting the form to specify how their post should be tagged. Tagging is a good way to specify organizable key words and subjects that the post relates to. The Post Tags field provides the option to specify which field type the field should display as. Available field types are: Single Line Text, Drop Down, Multi Select, Checkboxes, and Radio Buttons. If using the “Single Line Text” field type, note that the expected format is a comma-delimited list of tags.

6. Uploading Images to the Post Gallery

Adding a Post Image field to your form will allow the user submitting the form to upload an image to the post gallery. You can include uploaded Post Images in the post content using the “content template” functionality. See the Post Body section above for more details.

The Post Image field also provides options for collecting image meta data. Checking any of the image meta data options will add an additional input to the Post Image field which can be filled in by the submitting user. This data is then stored with the Post Image.

7. Setting the Featured Image

You can specify a particular Post Image field to also be set as the Featured Image (aka Post Thumbnail) of the created post. Just select the “Set as Featured Image” option and Gravity Forms will work it’s magic when the post is created.

Post Image: Setting Featured Image

8. Creating Custom Fields

Adding a Post Custom Field will allow the user submitting the form to enter a value which will be stored in a custom field as part of the created post. Custom fields are a simple way to bind related data to a post. Here’s a real example of how the settings might be configured:

Post Custom Field Settings

With the above configuration in mind, imagine that you’re accepting user-submitted events for a blog about your night life. The data and time of the event will be pretty important. Custom fields to the rescue! With Gravity Forms’ Post Custom Field, you can specify a custom field to which the field value (in this case, the date of the event) should be mapped.

The Post Custom Field can use a variety of different field types including all Standard Field types and most Advanced Field types. This flexible field will allow you to capture a wide range of values include regular text, dates, times, phone numbers, URLs, files and more!

It is important to note that Gravity Forms does not handle displaying the custom field data (unless you’re using a content template!); however, there are plenty of tutorials available for modifying what content is displayed with your posts including displaying custom fields! For more information, see the Custom Fields documentation on WordPress.org.

9. Setting the Default Post Status

You can specify the default Post Status from the Post Title, Post Body and Post Excerpt fields. The available options are “Draft”, “Pending Review” or “Published”. A “draft” is a post that is not yet ready to be published. A post which is “Pending Review” is ready to be published pending a review by an administrator. A “published” post is live and viewable by visitors on your website.

Gravity Forms may not support it out of the box, but it’s actually quite easy to set the post status by a user-submitted field value. Here are two handy resources that demonstrate how!

  1. Set Post Status by Field Value
  2. Set Post Status by Field Value (Advanced)

10. Setting the Post Author

Like the Post Status, the default Post Author can be set from the Post Title, Post Body and Post Excerpt fields. You must select a user from the “Default Post Author” drop down; however, if you wish to assign the post author based on the logged in user submitting the form, just check the “User logged in user as author” option. Bare in mind, this option will only work if the user is logged in when submitting the form. Otherwise, the post author will default to the user selected in the drop down.

11. Set the Default Post Format

If you’re running a theme that supports Post Formats or if you’re using implementing them on your own theme, you’ll be happy to hear that Gravity Forms provides support for Post Formats out of the box. The Post Format can be specified on the Post Title and Post Body fields. All standard WordPress Post Formats are supported.

If you’d like some more information on post formats, I’d recommend checking out this walk-through.

Summary

That’s a fairly exhaustive overview of the post creation functionality. As you can see, Gravity Forms post creation functionality is very flexible and super powerful! If you have any questions, please share them with us in the comments.

Comments

  1. says

    Hi David,

    I am developing a property developer website and i want to have a simple property booking form which allow user to book the apartment there by just entering few basic information such as name, email phone and apartment no. listed as dropdown list. Once the selected apartment no. is booked it should become disable for further booking unless site admin enable it. Also on the admin side i want site admin to approve and reject the booking which will basically disable or enable the apartment no in the dropdown.

    I tried many time but not able to find any solution also new to GF. Your prompt response is highly appreciated.

    You can visit following http://ibtikarrealestate.com/our-projects/ongoing-projects/project-1/ check for reservation list.

  2. Anne P says

    Hi David!

    Thanks for this tutorial, it’s very helpful. How would I add a link to the newly created post in the User notification email and/or the form confirmation?

    Thanks! Anne

  3. says

    Hi, thanks for this tutorial, I’v learned a lot. Can you cover how to add the Link to the Post in the confirmation / notification message please? Thanks!

  4. S Kaul says

    Hi David,

    Is there a way for a Dropdown Field to be dynamically populated by a specific Woocommerce Product Attribute? GF+CPT used to do this for me, but since it’s abandoned there is no other way to do it. Any ideas?

  5. Zack says

    Hey, David. Awesome article, again!

    I’m creating a form where logged in users can post, but I need them to be able to choose the author from a list. I know I can add a dropdown menu that lists all the authors on the site on a form, but how to do I attribute that value to the post’s author field?

  6. says

    Hi David, Any way to connect a date field to be the “publish date” for a post?

    I’ve setup and have a mostly working GForm that takes article submissions for a school weekly bulletin. It maps the categories and I’ve used 2 plugins to get a WYSIWYG post body and ‘Media’ button for uploads working, along with the plugin you have mentioned in the comments “Gravity Forms: Post Updates”.

    The final part is getting the submissions to be scheduled for a specific date, I’ve just started looking into how to do this and thought I’d drop you comment in case you had come across this idea?

    I also have a fall back to create a tagging setup for term and week then have the editor update the blog each Monday to the correct week and term tags only.

    Also <3 GWiz, Thanks!

  7. Jacques LeCavalier says

    Hi there. I want to do something very simple, but I’m not sure how. I have a course evaluation form that has many fields (radio buttons, text fields, etc.) and I just want to create posts that contain all the information entered in the form, as well as the field labels, etc.

    I like the format of the entries that I can view in my WP dashboard and I’d be happy for the posts to just look like that. How can I “convert” these entries to posts, using the course title as the post title?

    thanks. Jacques

    • David Smith says

      Hi Jacques, I don’t know of any solutions for converting existing entries to posts; however, for new entries, you can add a Post Title field to be used as the Course Title. When the user submits the form, the value will be assigned to the newly created post. The rest of this tutorial will demonstrate how you can convert the other fields to Post-based fields and then those values can also be captured in the created post.

  8. John says

    Thanks for your article, David. I’ve been trying to figure out if it’s possible to use Gravity Forms to charge someone to post content on my site. I’m thinking it would be a per-post charge, but I might also consider charging a monthly fee. Any ideas?

  9. says

    David,

    This article was awesome! I wanted to know the best way to do this. I am creating a memorial site where I want people to be able to post thoughts about their friend that has passed on. I want it simple. Go to the page, type your name, type your content and publish. It’s just an online guestbook.

    I have two questions: 1) I don’t see featured image anywhere in my list to add to the body content and 2) I don’t want people to register. Should I just create a basic user that everyone logs in under?

    Thanks so much

    • David Smith says

      Hi Bodie,

      1. You would need to add a Post Image field and then you can insert the merge tag for that field into the Post Content Template.
      2. Users do not need to register to create a post. You can assign a default author to which the post will be attributed via the Post Title and Post Body fields.
  10. Rob says

    In gravity forms when adding a custom field in the post fields section, when selecting the drop down field type, is it possible to add the “Populate with post type” option when using the Gravity Forms + Custom Post Types plugin?

    This works for a standard drop down field but not a custom field with the field type set to drop down.

    • David Smith says

      Hi Rob, I’m assuming this is not possible out of the box with that plugin. If you’d like to map it to custom field you can add a hidden custom field type and also a standard drop down. Enable the populate with post type option on the standard drop down and then map the value from the standard drop down to the custom field with either this snippet or GP Copy Cat (which now supports automatically copying a value without having to check a checkbox).

    • Rob says

      Hi David, Thanks for getting back to me. I managed to adjust the plugin to include the custom field so it now works like a standard drop down.

  11. says

    Is it possible to use this to create accounts for the persons creating the pages with a form? I would like to sell themed mini-sites and this looks good, but there is a lot to it… user accounts, and the ability to login and make changes, etc. Any ideas or direction would be appreciated!

  12. says

    Hey David,

    You’ve been so helpful in the past, I figured I’d give this a shot here. I’d like to be able to allow the creation of a new category by the user when filling out the form.

    So, “Joe” comes to the site, uses the form to create his post, and one of the fields is for the category. However, instead of a pre-populated list to choose from, he is given the option to create the category by typing in whatever he’d like.

    Is this remotely possible? Thanks in advance!!!

  13. says

    Hi, thank you for the awesome article. Is there a way to add not just featured image, but several images and than display them in picture gallery associated with post created with GF backend?

  14. says

    Hello is it possible to have the form turn into a post automatically with out the user having to submit a picture or category. Example: A resume submission form that creates a post so we can have a page that shows all of the resume submissions. Thank you

    • David Smith says

      Hi Chris, this would make a great tutorial. I’ve added it to the queue. In the meantime, here’s a top-level list:

      1. Create a custom post type
      2. Make sure custom post type has an archive page
      3. Configure Gravity Forms to create post of the custom post type
      4. That’s pretty much it…
    • Craig Tommola says

      You can also have only some categories offered, but only offer one, then make that field hidden. It will by default go to that category and automatically have an archive, etc.

  15. Meg Seegmiller says

    Is it possible to create a form where the user could create theoretically an unlimited number of posts connected to one form entry?

    Here’s the scenario: In addition to filling out a project planning guide through a form on my website, I’d like for my clients to be able to submit page content for each of their pages directly to me. Each client is different and will have a different number of pages to submit. Is this possible?

    • David Smith says

      To be clear, regardless of what client is submitting the form, all the posts would be created on the same site?

    • David Smith says

      Rather than creating multiple posts from a single entry. It might be easier to allow the user to signup for an account or simply require they use the same email address. Then you can let them submit the form as many times as they need, each submission being a separate page.

      If you’re collecting other stuff on that form that you don’t want them to have to repeat, breaking the post fields into a separate form would solve that.

  16. says

    Hi thanks for the great post Ive just created a testimonial type system using this and I was wondering would there be a way to add a star rating to these testimonials perhaps using the survey extension on GF as it has a star rating option.

    • David Smith says

      Hi Jade, the Survey add-on does offer a star rating field; however, it isn’t possible to map this to the created post.

      Here’s a quick and dirty solution that might help.

      1. Create a Custom Field and set the “Field Type” to “Number” (screengrab).
      2. Add an HTML field and paste this code into the “Content” setting (screengrab).
      3. In the code snippet, update the “733” in “#input_733_3″ to your form ID.
      4. Update the “3” in “#input_733_3″ to the field ID of the Custom Field we added in Step #1.
      5. Done!

      End result should look something like this: http://grab.by/EKKS

  17. Ben says

    Is there a way to have the user register in that same form where he publish the post and then let him edit the post when ever he wants to with those registration details?

    Thanks, Ben

  18. says

    Thanks for the awesome article. We are currently looking at different ways (i.e the best way) to allow users to submit User Generated Content from the front end. So far this seems to be the most elegant way.

    One question though, do you know if it is possible to only allow registered users to submit the form to a post. Or even if we could restrict to a certain user level (i.e Contributor).

    Cheers, Chris

    • David Smith says

      A codeless solution would be to add a Post Category field with the desired category preselected. You can then hide the Post Category field with the “gf_hidden” CSS class – or – mark it as Read only.

    • Craig Tommola says

      I’d set it to admin only but it didn’t allow preselection. However, by setting it to only allow certain categories, and only allowing one, it assigned it to the only available … um … of course :)

      Thx CT

  19. Ronel says

    “I’ve just responded to your email. Short answer, is yes, you can use GF to create WooCommerce products. Use the GF + Custom Post Types plugin (link in the first tip of this article) to create “product” post types instead of “post” post types. Then use GF Post Custom fields to allow the user to define the price and other options.”

    I’ve installed both plugins, but there is no option to link a new post via GF to products post type. Is there additional PHP that needs to be added anywhere? It seems the GF plugin doesn’t have any settings of its own. I’d really appreciate your help.

    • David Smith says

      Hi Ronel, the documentation from the GF + Post Custom Types plugin says:

      How to map a form to a custom post type

      Add a post title field to your form and under the advanced tab, tick the "Save As Post Type" checkbox. A dropdown will appear with the available post types. Select the one you want.

      Are you not seeing this option? If so, the developer of the plugin might be able to help you get that sorted.

  20. asd says

    is it possible to use Gravity Forms to Create Product for woocommerce? I want to know if you have any suggestions to send the contents of a module in a product that after I’ve checked it, I can publish and sell it in woocommerce. thanks

    • David Smith says

      I’ve just responded to your email. Short answer, is yes, you can use GF to create WooCommerce products. Use the GF + Custom Post Types plugin (link in the first tip of this article) to create “product” post types instead of “post” post types. Then use GF Post Custom fields to allow the user to define the price and other options.

  21. Oyta says

    When you use Lists to popular a WP post body, the content is submitted in a table format which is hard to style.Especially the column headers show up and I have no way of hiding that. Do you know how to get Gravity Forms not to pass the Column header data (I can’t leave it blank in the form because users still need to know what to write in the columns).

    • David Smith says

      Can you provide me an example of the generated content you’re working with? A URL is preferable to a screenshot.

Trackbacks

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>