spivurno
9/13/2012 - 12:03 AM

Gravity Wiz // Set Post Status by Field Value

Gravity Wiz // Set Post Status by Field Value

/**
* Set Post Status by Field Value
* http://gravitywiz.com/2012/05/04/set-post-status-by-field-value/
*/

// update "3" to the ID of your form
add_filter('gform_post_data_3', 'gform_dynamic_post_status', 10, 3);
function gform_dynamic_post_status($post_data, $form, $entry) {
    
    // update "5" to the ID of your custom post status field
    if($entry[5])
        $post_data['post_status'] = $entry[5];
    
    return $post_data;
}