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 default value for the post category field in a custom post type

  1. riskiii
    Member

    I have followed the forum topic, and used the following code:

    function dgs_set_post_type($post_data, $form) {
    
       if ( $form[ 'id' ] == '1' ) {
          $post_data[ 'post_type' ] = 'cpt_hr_posts';
          $post_data[ 'tax_hr_posts_category' ] = 'our-space';
          $group = 'our-space';
       }
    
       return $post_data;
    }
    add_filter('gform_post_data', 'dgs_set_post_type', 10, 2);

    I used the advanced tab on the group, and gave the parameter field the value of "group". The default value from the custom taxonomy will be "our-space". In case you need it the taxonomy name is "tax_hr_posts_category". In additon to putting the value in the hooks, I tried the get values of http://intranet.omrf.hsc.net.ou.edu/our-space/?group=our-space where "our-space" is a page with the shortcode added.

    Posted 13 years ago on Wednesday July 6, 2011 | Permalink
  2. riskiii
    Member

    Bump, I am hoping someone can point me in the right direction....

    Posted 13 years ago on Thursday July 7, 2011 | Permalink
  3. What happens and what did you expect to happen? I use CPT with Gravity Forms and I am unclear what sort of trouble you're having.

    Posted 13 years ago on Friday July 8, 2011 | Permalink
  4. I couldn't tell what you were asking based on your original post, it looked more like a code example and a statement rather than a question. Can you clarify what exactly the issue is that you are having?

    Posted 13 years ago on Friday July 8, 2011 | Permalink