Speed Up Your Gravity Forms Testing: Unrequire Required Fields
Filling out field after required field can rot your brain. Save a huge amount of time by automatically unrequiring required fields.
October 3rd, 2015: You can now download code as a plugin.
Stop! There's a better way.
This snippet is available as a plugin with Gravity Perks, a suite of over 47 premium Gravity Forms plugins!
I’ve been using this snippet for quite some time with my Gravity Forms development. I never thought to share it until a client was complaining to me about how much of a hassle it was to test their multi-page registration form with each page chock-full of required fields.
This is exactly why I use this snippet. I work with Gravity Forms all day every day and given Gravity Forms’ continuing popularity, there is a good chance you have found yourself working with this awesome plugin more and more. And the more you work with Gravity Forms, the more you realize how mind-numbingly tedious it is to enter field after field of dummy info so you can submit the form without hitting the required field validation error.
This simple snippet will allow you to “unrequire” all of your form’s required fields by adding a
gwunrequire parameter to your query string. Just like that you can bypass any required field
- Using the Snippet
Using the Snippet
- This will work with even Gravity Forms v1.0 but that’s no excuse not to be running the latest version.
- Copy and paste the snippet into your theme’s functions.php file.
- You’re good to go! Make sure you are logged in as an administrator and add
gwunrequireas a query parameter to any URL where you are displaying a Gravity Form to bypass any required fields.
Example on GF Form Preview
There are some configuration options available. Review the usage instructions below for more details.
The basic usage requires that the user be logged in as an administrative user and that the
gwunrequire parameter be present in the query string.
Enable for All Users (including visitors)
Allows you to unrequire fields without being logged in. Not advisable for live servers.
new GWUnrequire( array(
'admins_only' => false
Enable Automatically (no query parameter)
You may find that you don’t want to be bothered with having to add the query parameter. You can disable this requirement to allow administrative users to automatically bypass required fields.
new GWUnrequire( array(
'require_query_param' => false
admins_only bool optional
Only allow administrators to bypass required fields. Defaults to
require_query_param integer optional
gwunrequirequery parameter to be present in the query string to bypass fields. Defaults to
You might think it would make more sense to simply wait until you’ve ironed out all the kinks before setting your fields as required. That is viable for small forms, but for larger forms it can be very painful to go back through tens (hopefully not hundreds) of fields to set a single setting.
With this approach, you can configure the field completely the first time through. No need to hassle with the tiresome task of marking each field as required at the end, or worse, forgetting to do so.
If you are debugging new issues that have popped up with old forms, you will be especially appreciative of how much time this snippet can save you. This is the scenario that I have found this snippet to be the most beneficial.
I hope you find this useful and look forward to any feedback you have!