• Hi
    I am using Gravity Forms + Custom Post Types to create a custom post type. The category is saved as the taxonomy ID in the entry table:
    https://www.evernote.com/l/ABU_Eak3lHVEPJAZkh7UOnAWbTEE5sWcn7Y

    GF is able to display as the category name in the notification emails:
    https://www.evernote.com/l/ABWMgGLnetxLJK24MIoAn5p69se4cu2L1gY

    I can use the merge tag: {Tree Campaign:7} in email notifications and it works fine:
    https://www.evernote.com/l/ABWiiPQPwnBB-L0ThFufubAFroClVUcsy3Q

    But I need the entry table to store the Name and not the ID. I have tried adding other hidden fields, single line, paragraph, hidden etc to the form with the same merge tag: {Tree Campaign:7} – but nothing seems to work.

    Can you help me save the category name in the entry table please? It is very important as I sync the table information with another email program and need the name not the ID.

    I have contact GF support and they say I need to speak with you about this. They helped me develop this code to save the post category as a hidden field:

    /*GF action for tree_campaign_name*/
    add_action( 'gform_pre_submission_26', 'pre_submission' );
    function pre_submission_handler( $form ) {
    
    $cat_id = rgpost( 'input_7' );
    $cat = get_term( $cat_id, 'category' );
    $cat_name = ! is_wp_error( $cat ) && is_object( $cat ) ? $cat->name : '';
    $_POST['input_19'] = $cat_name;
    
    }

    But this doesn’t work as it is not a standard post or category.

    Any ideas on how to do this or adapt this code to work with the custom post types created by your plugin?

    It’s for taxonomy=tree-campaigns&post_type=trees

    thanks in advance for the help

    https://www.ads-software.com/plugins/gravity-forms-custom-post-types/

  • The topic ‘How to save CPT taxonomy name in entry table?’ is closed to new replies.