Post Picker for Gravity Forms revolutionizes how you collect post-related data in your forms by adding a sophisticated custom field type that seamlessly integrates with the Gravity Forms ecosystem.
This plugin solves a common problem: allowing users to select from existing content on your WordPress site through forms. Whether you need visitors to choose from blog posts, select products, pick events, or reference any custom post type content, Post Picker for Gravity Forms makes it effortless.
Unlike basic dropdown fields that require manual option entry, Post Picker for Gravity Forms automatically populates dropdown menus with real content from your WordPress database. The field dynamically loads up to 50 posts from your chosen post type, displaying them alphabetically by title for easy selection.
The plugin maintains data integrity by storing post IDs internally while displaying human-readable post titles to users. This approach ensures that even if post titles change, your form entries remain accurate and meaningful.
Post Picker for Gravity Forms is built using the official Gravity Forms Add-On Framework, ensuring maximum compatibility and following WordPress coding standards. The plugin includes comprehensive validation, sanitization, and security measures to protect your site and data.
For developers, the plugin includes the ppfgf_get_posts_args filter, allowing complete customization of the post query. You can modify which posts appear, change ordering, add meta queries, filter by date ranges, or implement any custom logic your project requires.
Post Picker for Gravity Forms is built with developers in mind and includes several hooks and filters for customization.
ppfgf_get_posts_args
The main filter for customizing which posts appear in the dropdown. This filter receives three parameters:
$args (array) – The WP_Query arguments$post_type (string) – The selected post type$field (PPFGF_Field) – The field objectLimit to Recent Posts
“php
add_filter( 'ppfgf_get_posts_args', function( $args, $post_type, $field ) {
// Only show posts from last 30 days
$args['date_query'] = array(
array(
'after' => '30 days ago',
),
);
return $args;
}, 10, 3 );
“
Change Post Ordering
“php
add_filter( 'ppfgf_get_posts_args', function( $args ) {
// Order by date instead of title
$args['orderby'] = 'date';
$args['order'] = 'DESC';
return $args;
} );
“
Filter by Meta Field
“php
add_filter( 'ppfgf_get_posts_args', function( $args ) {
// Only show featured posts
$args['meta_query'] = array(
array(
'key' => 'featured',
'value' => '1',
'compare' => '='
)
);
return $args;
} );
“
Increase Post Limit
“php
add_filter( 'ppfgf_get_posts_args', function( $args ) {
// Show up to 100 posts instead of 50
$args['posts_per_page'] = 100;
return $args;
} );
“
Filter by Category (for Posts)
“php
add_filter( 'ppfgf_get_posts_args', function( $args, $post_type ) {
if ( 'post' === $post_type ) {
// Only show posts from specific category
$args['category_name'] = 'events';
}
return $args;
}, 10, 2 );
“
Field-Specific Filtering
“php
add_filter( 'ppfgf_get_posts_args', function( $args, $post_type, $field ) {
// Only apply to specific field ID
if ( 5 === $field->id ) {
$args['author'] = 1; // Only posts by user ID 1
}
return $args;
}, 10, 3 );
“