Post Picker for Gravity Forms
Post Picker for Gravity Forms
Description
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.
What Makes Post Picker for Gravity Forms Special?
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.
Core Features
- Universal Post Type Support – Works with Posts, Pages, and all custom post types registered on your site
- Smart Data Handling – Stores post IDs but displays post titles for better user experience
- Native Gravity Forms Integration – Appears in the Advanced Fields section alongside other professional field types
- Enhanced UI Compatible – Fully supports Gravity Forms’ Enhanced UI for improved mobile experience
- Conditional Logic Ready – Complete support for Gravity Forms conditional logic functionality
- Merge Tag Compatible – Works seamlessly with all Gravity Forms merge tags and notifications
- Customizable Placeholder – Set custom placeholder text or use the default “Please Select”
- Validation Built-in – Automatically validates that selected posts exist and are published
- Developer Friendly – Includes filters for customizing post queries and extending functionality
- Performance Optimized – Efficient database queries with built-in limits and caching considerations
Perfect For These Use Cases
- Contact Forms – Let users select which product or service they are contacting you about
- Support Ticket Systems – Let users reference specific documentation or FAQ posts
- Event Registration Forms – Let attendees select which event they’re registering for
- Product Inquiry Forms – Allow customers to ask questions about specific products
- Content Voting Systems – Enable users to vote on their favorite blog posts or content
- Appointment Booking – Let clients select from available time slots stored as custom posts
- Course Registration – Allow students to enroll in specific courses from your course post type
- Real Estate Inquiries – Let prospects inquire about specific properties
- Job Applications – Allow applicants to apply for specific job openings
Technical Excellence
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.
Developer Features
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.
Developer Information
Post Picker for Gravity Forms is built with developers in mind and includes several hooks and filters for customization.
Available Filters
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 object
Code Examples
Limit 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 );
“
Installation
Automatic Installation
- Log in to your WordPress admin panel
- Navigate to Plugins > Add New
- Search for “Post Picker for Gravity Forms”
- Click “Install Now” and then “Activate”
Manual Installation
- Download the plugin zip file
- Log in to your WordPress admin panel
- Navigate to Plugins > Add New > Upload Plugin
- Choose the zip file and click “Install Now”
- Activate the plugin
After Installation
- Make sure Gravity Forms is installed and activated
- Create or edit a Gravity Form
- Add the Post Picker field from the Advanced Fields section
- Configure the post type in the field settings
- Save your form and test it on the frontend
Faq
Adding a Post Picker field to your Gravity Form is simple:
- Navigate to your WordPress admin and go to Forms > Forms
- Edit an existing form or create a new one
- In the form editor, click the “Add Field” button
- Look for “Post Picker” in the Advanced Fields section (it appears alongside Name, Date, Time, and other advanced fields)
- Drag the Post Picker field to your desired location in the form
- Click on the field to open the field settings panel
- Configure the “Post Type” dropdown to select which post type you want to display (Posts, Pages, or any custom post type)
- Optionally customize the field label, description, and placeholder text
- Save your form
Post Picker for Gravity Forms supports all public post types registered on your WordPress site. This includes:
- Built-in WordPress post types: Posts and Pages
- Custom post types: Any custom post type created by themes or plugins (such as Products, Events, Portfolio items, etc.)
- Plugin-created post types: Post types from WooCommerce, Events Calendar, Custom Post Type UI, and other plugins
The plugin automatically detects and lists all available public post types in the Post Type dropdown when configuring the field. Only viewable post types are included to ensure users can only select from appropriate content.
Post Picker for Gravity Forms uses a smart dual-storage approach:
- Database Storage: The post ID is stored in the database for data integrity and relationships
- Display Value: The post title is displayed in form entries, email notifications, and merge tags for human readability
This means if you change a post title later, your form entries will automatically reflect the updated title while maintaining the correct reference to the original post. The post ID ensures data accuracy even if content is modified.
Post Picker for Gravity Forms has full support for Gravity Forms conditional logic. You can:
- Show or hide the Post Picker field based on other field values
- Use the Post Picker field selection to show or hide other fields
- Create complex conditional logic chains involving the Post Picker field
- Use conditional logic with confirmation messages and notifications
The field integrates seamlessly with Gravity Forms’ conditional logic system, treating post selections just like any other field value.
Absolutely! Post Picker for Gravity Forms is fully compatible with Gravity Forms merge tags. You can use the field value in:
- Email notifications – Include the selected post title in admin and user emails
- Confirmation messages – Display the selected post in thank you messages
- Conditional notifications – Send different emails based on which post was selected
- Third-party integrations – Pass post data to external services via webhooks or API integrations
The merge tag will display the post title (not the ID) for better readability in communications.
Post Picker for Gravity Forms displays up to 50 posts in the dropdown by default. Posts are ordered alphabetically by title for easy browsing. This limit ensures good performance even on sites with thousands of posts.
If you need to display more posts or change the ordering, you can use the ppfgf_get_posts_args filter to customize the query (see the Developer Information section below).
Post Picker for Gravity Forms includes developer-friendly filters that allow you to customize exactly which posts appear. You can filter by:
- Date ranges (e.g., only posts from the last 30 days)
- Meta field values
- Author
- Categories or taxonomies
- Custom criteria
See the Developer Information section below for code examples.
Post Picker for Gravity Forms fully supports Gravity Forms’ Enhanced UI feature. When Enhanced UI is enabled for the field, it provides:
- Improved mobile experience with native mobile dropdowns
- Better accessibility features
- Enhanced styling that matches your theme
- Improved usability on touch devices
Simply enable “Enhanced UI” in the field settings to activate this feature.
Post Picker for Gravity Forms handles this gracefully. If a post is deleted after someone has selected it in a form:
- Existing entries will show the post ID instead of the title in the admin (since the title is no longer available)
- New submissions will not be able to select the deleted post (it won’t appear in the dropdown)
- Validation prevents submission of invalid post IDs
The plugin includes built-in validation to ensure only published, existing posts can be selected.
Post Picker for Gravity Forms only displays posts with a “publish” status by default. This ensures that users can only select publicly available content.
If you need to include posts with custom statuses, you can use the ppfgf_get_posts_args filter to modify the query and include additional post statuses.
Post Picker for Gravity Forms is designed with performance in mind:
- Efficient queries – Uses optimized WordPress queries with appropriate limits
- Minimal database impact – Only queries posts when the form is displayed
- No frontend JavaScript – Uses native HTML select elements for fast rendering
- Caching friendly – Compatible with WordPress caching plugins
The plugin adds minimal overhead to your forms and won’t slow down your site.
Yes! Post Picker for Gravity Forms is fully translation ready and includes:
- Text domain:
post-picker-for-gravity-forms - POT file included for translators
- RTL support – Works with right-to-left languages
- WordPress.org translation system compatibility
All user-facing strings are properly internationalized and ready for translation into any language.
Yes! Post Picker for Gravity Forms uses standard Gravity Forms CSS classes and markup, making it easy to style:
- Uses the same CSS classes as other Gravity Forms select fields
- Inherits your theme’s form styling automatically
- Compatible with Gravity Forms’ built-in styling options
- Can be customized with additional CSS classes in the field settings
The field will automatically match your existing form styling without additional work.
Post Picker for Gravity Forms requires:
- WordPress: 6.0 or higher
- PHP: 7.4 or higher
- Gravity Forms: 2.5 or higher (the plugin uses the official Gravity Forms Add-On Framework)
The plugin is tested up to WordPress 6.8 and follows WordPress coding standards for maximum compatibility.
Reviews
Changelog
1.0.0
- Initial release