Description
The gform_embed_post_types
allows users to modify the post types presented in the Embed Form flyout.
Usage
The filter which would run for all forms would be used like so:
add_filter( 'gform_embed_post_types' , 'your_function_name' ); |
Parameters
-
$types array
An associative array of post types.
Examples
1. Adds the post type book
This example adds the post type with slug book
to the Embed Form flyout.
add_filter( 'gform_embed_post_types' , function ( $types ) { $types [] = array ( 'slug' => 'book' , 'label' => 'Book' ); return $types ; } ); |
2. Removes the post type post
This example removes the standard post
post type from the Embed Form flyout.
add_filter( 'gform_embed_post_types' , function ( $types ) { $types = array_filter ( $types , function ( $type ) { return $type [ 'slug' ] != 'post' ; } ); return $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 v2.6.
Source Code
This filter is located in includes/embed-form/config/class-gf-embed-config.php