WordPress.org

Support

Support » Plugins and Hacks » Gravity Forms Custom Post Types Change post status based on checkbox

Gravity Forms Custom Post Types Change post status based on checkbox

  • I’m not sure how to alter the post status based on a check box… I think my hook is getting messed up because of the publish status on the post title field…

    thoughts?

    This is my code

    // where 4 is my form id
    add_filter('gform_post_data_4', 'gform_dynamic_post_status', 10, 4);
    function gform_dynamic_post_status($post_data, $form, $entry) {
    
        // where 17 is my field id
        if($entry[17]) {
        switch($entry[17]) {
            case 'Yes.':
                $post_data['post_status'] = 'pending';
                break;
            case 'No':
                $post_data['post_status'] = 'publish';
                break;
            }
        }
    
        return $post_data;
    }

    But it doens’t work. Still keeps publishing to “published” rather than pending for the custom post type

  • The topic ‘Gravity Forms Custom Post Types Change post status based on checkbox’ is closed to new replies.