gform_post_status_options

Description

Use this filter to add custom post statuses to the post status drop down on the Properties tab of post fields.

Usage

add_filter( 'gform_post_status_options', 'your_function_name' );

Parameters

  • $post_status_options array

    Array containing the statuses of Draft, Pending Review, Published

Examples

1. Add a new status

This example adds a custom status to the drop down.

add_filter( 'gform_post_status_options', 'add_custom_post_status' );
function add_custom_post_status( $post_status_options ) {
    $post_status_options['custom_status'] = 'My Custom Status';
    return $post_status_options;
}

2. Remove a status

This example removes Draft as being a selectable choice in the drop down.

add_filter( 'gform_post_status_options', 'add_custom_post_status' );
function add_custom_post_status( $post_status_options ) {
    unset( $post_status_options['draft'] );
    return $post_status_options;
}

Placement

This code should be placed in the functions.php file of your active theme.

Source Code

This filter is located in form_detail.php.