gform_post_select_post_types

Description

The gform_post_select_post_types filter in Gravity Forms allows additional post types to be used when the Settings API renders a field of type post_select.

Usage

add_filter( 'gform_post_select_post_types', 'your_function_name' );

Parameters

  • $post_types array
    The post types allowed for use in a post_select field. Default value is ['post','page'].

Examples

This example allows the field to return posts of type event.

add_filter( 'gform_post_select_post_types', function( $post_types ) {

    $post_types[] = 'event';

    return $post_types;

} );

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

Since

This filter was added in Gravity Forms version 2.6.2.

Source Code

This filter is located in GF_Settings_Config_Admin::data() in includes/settings/config/class-gf-settings-config-admin.php.