Gravity Forms Require If WP Registry grade A. No security issues foundWP RegistryNo security issues foundOpen the reportA
Make the required state of supported Gravity Forms fields conditional — based on form field values, user roles, URL parameters, and more.
Install
Upload it under Plugins → Add New Plugin → Upload Plugin, then activate.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/guilamu/gf-require-if/releases/download/v1.1.0/gravity-forms-require-if.zipMake the required state of supported Gravity Forms fields conditional — based on form field values, user roles, URL parameters, and more.

Conditional Required Rules
- Set fields as required only when specific form field values match
- Combine multiple rules with ALL (AND) or ANY (OR) logic
- Evaluate against form fields, user roles, user meta, page/post ID, URL parameters, or custom developer conditions
- Supports operators: is, is not, greater than, less than, contains, starts with, ends with
Real-Time Frontend Evaluation
- Required indicators appear/disappear instantly as users fill the form
- Respects the form's required indicator setting (text, asterisk, or custom)
- Works with AJAX-powered forms and multi-page forms
- Server-side validation ensures rules are enforced even with JavaScript disabled
Native Form Editor Integration
- Accordion UI matches Gravity Forms' native Conditional Logic panel
- Flyout rule builder with familiar dropdown interface
- Works alongside GF's built-in conditional logic and third-party add-ons
Key Features
- Non-Destructive: Only promotes fields to required; never demotes natively required fields
- Multilingual: Works with content in any language
- Translation-Ready: All admin strings are internationalized
- Secure: Server-side validation prevents bypassing via browser tools
- GitHub Updates: Automatic updates from GitHub releases
Requirements
- Gravity Forms 2.5 or higher
- WordPress 6.0 or higher
- PHP 8.0 or higher
Installation
- Upload the
gravity-forms-require-iffolder to/wp-content/plugins/ - Activate the plugin through the Plugins menu in WordPress
- Open any form in the Gravity Forms editor
- Select a supported field, then expand the Conditional Required accordion in the field settings sidebar
- Toggle the feature on and configure your rules
FAQ
Which field types are supported?
Text, Textarea, Email, Phone, Number, Select, Radio, Checkbox, Date, Time, and Website.
Can I combine multiple conditions?
Yes. Add multiple rules and choose ALL (every rule must match) or ANY (at least one must match).
What happens if JavaScript is disabled?
The server-side validator (gform_pre_validation) enforces the same rules, so conditional required fields are validated regardless of JavaScript.
Does it conflict with GF's native conditional logic?
No. If a field is hidden by GF's conditional logic, its "Require If" rules are skipped entirely.
Can I add custom developer conditions?
Yes. In the rule builder, choose the Custom (Developer) source and enter a condition key. Then handle that key with the grfi_evaluate_custom_condition filter — return the current value for your condition, and it will be compared (as a string) against the rule's value using the rule's operator:
add_filter( 'grfi_evaluate_custom_condition', function( $result, $condition_key, $rule ) {
if ( 'my_condition' === $condition_key ) {
return my_custom_check() ? 'true' : 'false';
}
return $result;
}, 10, 3 );
The filter runs both server-side (during validation) and at render time to feed the frontend engine, so return the same value in both cases. Returning null (the default) means "not handled", which evaluates as an empty string.
Does it work with page builders?
Yes. The frontend script initializes via multiple fallback methods (GF init script, action hook, jQuery event, and DOM-ready) to ensure compatibility with Elementor, Bricks, Gutenberg, and other builders.
Project Structure
.
├── gravity-forms-require-if.php # Main plugin file & bootstrap
├── class-gf-require-if.php # GFAddOn subclass (lifecycle, scripts, data injection)
├── uninstall.php # Cleanup on uninstall
├── README.md
├── assets
│ ├── css
│ │ ├── grfi-admin.css # Form editor sidebar styles
│ │ └── grfi-frontend.css # Frontend required indicator styles
│ └── js
│ ├── grfi-admin.js # Form editor accordion & flyout rule builder
│ └── grfi-frontend.js # Runtime conditional required evaluation
├── includes
│ ├── class-grfi-evaluator-gf.php # GF field value evaluator
│ ├── class-grfi-evaluator-wp.php # WordPress condition evaluator (roles, meta, etc.)
│ ├── class-grfi-field-settings.php # Field settings sidebar UI (PHP)
│ ├── class-grfi-validator.php # Server-side validation (gform_pre_validation)
│ ├── class-github-updater.php # GitHub auto-updates
│ └── Parsedown.php # Markdown parser for the plugin details popup
└── languages
├── gf-require-if-fr_FR.mo # French translation (binary)
├── gf-require-if-fr_FR.po # French translation (source)
└── gf-require-if.pot # Translation template
Changelog
1.1.0 - 2026-07-17
- Improved: Frontend payload now rides Gravity Forms' native init-script pipeline (
GFFormDisplay::add_init_script) instead ofwp_footer— more reliable with AJAX forms, multi-page forms, and forms rendered after the footer (popups, page-builder modals) - Improved: Stale "This field is required" errors are cleared when a field flips back to not-required (only when the field is empty, so genuine format errors are never hidden)
- Fixed: Server-side rule matching is now case-insensitive, mirroring the frontend engine — client and server always agree on whether a field is required
- Fixed: Translations now load correctly for self-hosted installs (
load_plugin_textdomain) - Fixed: "View details" popup footer no longer blank when the plugin is up to date (download link is always provided)
- Fixed:
grfi_evaluate_custom_conditiondocumentation now matches the actual filter signature; removed docs for the unimplementedgrfi_wp_condition_sourcesfilter - Changed: Frontend debug logging is off by default (enable with
window.grfiDebug = true) - Changed: README restructured with badges, Security and Contributing sections, and a dated changelog
1.0.3
- Improved: Hardened GitHub auto-update integration to match the WordPress GitHub auto-update reference flow
- New: Safe plugin details fallback handling, release-note injection, banner styling, and image stripping for the modal
- New: GitHub Actions release workflow to publish a correctly named plugin zip asset
1.0.2
- Fixed: Ignore unsupported field types in the form editor Require If lifecycle
- Fixed: Prevent field-settings collisions with third-party fields such as Chained Selects
1.0.1
- Improved: GitHub updater rewritten to use Parsedown for README.md parsing
- New: "View details" thickbox link in plugin row meta
- New: Gravity Forms version requirement in plugin info sidebar
1.0.0
- Initial release
- Conditional required rules with AND/OR logic
- Form field, user role, user meta, page ID, URL parameter, and custom condition sources
- Real-time frontend evaluation with form-specific required indicators
- Server-side validation via
gform_pre_validation - Native accordion & flyout UI in the form editor
- GitHub auto-updater
Security
If you discover a security vulnerability in this plugin, please report it responsibly through GitHub Security Advisories. Do not open a public issue for security reports.
Contributing
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
For translations, the plugin uses WordPress i18n. You can contribute translations by editing the .po files in the languages/ directory and generating the corresponding .mo files with the wp i18n CLI commands.
License
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0) — see the LICENSE file for details.
Made with love for the WordPress community
Releases
4 releases. Each count is every asset in that release; expand a row for the breakdown.