PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Set Post Type After Submission

  1. The default post type after submission of my form is 'Article'. I want it to be a custom post type called 'Review'. I've added the following into functions.php:

    add_action('gform_after_submission_1', 'set_post_type', 10, 2);
    	set_post_type('post_id','Review');

    It's pretty straightforward. I'm trying to to set the post type to 'Review' after the form is submitted. No luck. Any suggestions? Thanks!

    Posted 11 years ago on Sunday January 6, 2013 | Permalink
  2. You need a little help with that code. Try this instead:

    [php]
    // this will apply to form 1 only
    // change the _1 to your form ID if necessary
    add_action('gform_after_submission_1', 'gf_set_post_type', 10, 2);
    function gf_set_post_type($entry, $form) {
        set_post_type($entry['post_id'], 'Review');
    }

    Let me know if that works for you.

    Posted 11 years ago on Monday January 7, 2013 | Permalink