Gravity Forms Custom Development: When You Need a Developer
When Gravity Forms needs custom code: dynamic fields, custom validation, CRM and API integrations, custom add-ons, and keeping that code safe through updates.
You need a Gravity Forms developer when the form builder and official add-ons get you most of the way, but not all of it. Typical cases are fields that fill from your own data, validation rules specific to your business, sending entries to a system with no ready-made add-on, and building a custom add-on your team can configure without code. This article explains what Gravity Forms does on its own, where custom development starts, and how to make sure that custom code survives future updates.
What Gravity Forms does without custom code
Gravity Forms is one of the most flexible form plugins for WordPress. Before hiring anyone, check whether the built-in features already cover your needs. Out of the box, it handles:
- Conditional logic. Show or hide fields, pages and notifications based on answers.
- Multi-page forms with progress indicators.
- Calculations for quotes, order totals and scores.
- Notifications and confirmations. Send emails to different people based on answers, and show different messages or redirects after submission.
- Entries. Store, search, export and edit submissions in the WordPress admin.
Official add-ons extend this with payments, user registration, email marketing services, CRM systems and more. The Gravity Forms REST API v2 has been part of core since version 2.4, so outside systems can read forms and entries and submit forms without extra plugins. And the Webhooks Add-On can send entry data to many outside services.
If one of these does the job, use it. It will be maintained by the Gravity Forms team, which beats custom code you have to maintain yourself.
Signs you have outgrown the settings screen
These are the requests we see most often that need a developer:
- “The dropdown should list our current locations, products or staff, not a list someone typed in by hand.”
- “We need to check the entered number against our system before the form submits.”
- “Every entry should create a record in our internal tool, and that tool has no add-on.”
- “We have five forms that need the same integration, and our marketing team needs to set it up without code.”
- “A form is slow, or it breaks after every update, and nobody knows why.”
Each of these has a clean, documented way to solve it in Gravity Forms. The rest of this article walks through them.
Filling fields from your own data
Gravity Forms has a set of filters that let a developer change a form just before it is shown. The main one is gform_pre_render. It is commonly used to fill dropdowns, radio buttons and checkboxes with WordPress posts or other data.
The Gravity Forms docs recommend using the same function with three related filters. That way, the new choices also pass validation, are available during submission, and show correctly when editing an entry in the admin:
add_filter( 'gform_pre_render_5', 'vit_populate_locations' );
add_filter( 'gform_pre_validation_5', 'vit_populate_locations' );
add_filter( 'gform_pre_submission_filter_5', 'vit_populate_locations' );
add_filter( 'gform_admin_pre_render_5', 'vit_populate_locations' );
function vit_populate_locations( $form ) {
foreach ( $form['fields'] as $field ) {
if ( 'select' !== $field->type || false === strpos( $field->cssClass, 'populate-locations' ) ) {
continue;
}
$posts = get_posts( array( 'post_type' => 'location', 'numberposts' => -1, 'post_status' => 'publish' ) );
$choices = array();
foreach ( $posts as $post ) {
$choices[] = array( 'text' => $post->post_title, 'value' => $post->post_title );
}
$field->placeholder = 'Select a location';
$field->choices = $choices;
}
return $form;
}
The _5 at the end of each hook limits it to form ID 5. The field is marked with a custom CSS class in the form editor, so editors can see which field is filled by code.
Custom validation rules
The gform_field_validation filter lets you add your own rules to any field. It has form-specific and field-specific versions, such as gform_field_validation_10_2 for field 2 on form 10.
Real examples include:
- Checking a membership or order number against your database.
- Blocking bookings on dates that are already full.
- Making sure a number falls within a range that depends on another answer.
Good validation gives the user a clear message next to the field, which also matters for accessibility. Error messages need to be specific and announced to screen reader users. If your forms are a key part of your site, they should be part of any WordPress accessibility audit.
Sending entries to other systems
The gform_after_submission action runs after the entry is saved and notifications are sent. It is a common place to send data to a system that has no official add-on.
One detail many tutorials miss: this action also runs for entries marked as spam. Custom integrations should check for that first:
add_action( 'gform_after_submission_5', 'vit_send_to_internal_tool', 10, 2 );
function vit_send_to_internal_tool( $entry, $form ) {
if ( 'spam' === rgar( $entry, 'status' ) ) {
return;
}
wp_remote_post( 'https://tools.example.com/api/leads', array(
'timeout' => 15,
'headers' => array( 'Content-Type' => 'application/json' ),
'body' => wp_json_encode( array(
'name' => rgar( $entry, '1' ),
'email' => rgar( $entry, '2' ),
) ),
) );
}
For a quick integration, this works. For anything important, you also want error handling, retries, logging, and a way for staff to see whether each entry was sent. That is where a proper add-on comes in.
Building a custom add-on
Gravity Forms has an official Add-On Framework. It is the same foundation the official add-ons are built on. The two main classes are:
GFAddOn, the base class. It handles plugin and form settings pages, permissions, script loading, entry meta and clean uninstall.GFFeedAddOn, which extends it with feeds. A feed is a saved configuration that says “when this form is submitted, send these fields there.” Developers define the settings infeed_settings_fields()and the sending logic inprocess_feed().
There is also a GFPaymentAddOn class for payment gateways.
Why use the framework instead of a few hooks in functions.php?
- Your team can configure it. Marketing staff map fields and set conditions in the admin, with no code changes.
- It works across many forms. Add a feed to a new form instead of copying code.
- It looks and behaves like official add-ons. Settings live where people expect them.
- It follows Gravity Forms conventions, which makes it easier for any experienced Gravity Forms developer to maintain.
For moving data in from other systems, the GFAPI class offers functions to get, add and update forms and entries. One thing to know: GFAPI::add_entry() saves an entry directly and does not run validation, notifications or feeds. If you want those to run, you need to submit the form through the API instead. Choosing the wrong one is a common cause of “entries appear, but nobody got an email.”
Connecting forms to automations
Sometimes the need is not a single integration but a chain of actions: register the user, enroll them in a course, tag them in your email tool, and notify sales. You can code that by hand, but a tool like Uncanny Automator can often do it with less custom code. We explain how in our article on WordPress automation with Uncanny Automator.
Keeping custom form code healthy
Custom code is a long-term commitment. Forms often sit at the center of a business: leads, orders, applications. A broken form can go unnoticed for days.
We follow a few rules for all Gravity Forms work:
- Use documented hooks and APIs only. Internal functions can change in any release. The hooks and classes on docs.gravityforms.com are what the Gravity Forms team supports.
- Keep code in a plugin, not the theme. Switching themes should not break your forms.
- Target specific forms and fields. Use form-specific hook names so one form’s code does not affect another.
- Write automated tests. A browser test that fills out and submits each important form catches most problems after an update. See our guide to automated WordPress testing with Playwright and PHPUnit.
- Test updates on staging first. Gravity Forms and its add-ons update often. Our safe WordPress update process covers how.
Old form code that nobody understands is a classic example of technical debt. If your site has a lot of it, a good first step is to measure your WordPress technical debt and decide what to clean up first.
What to look for in a Gravity Forms developer
Ask any developer you are considering:
- Will you use official add-ons where they fit, and custom code only where they do not?
- Will the code use documented hooks and the Add-On Framework?
- How will it handle failed requests to outside systems?
- Will there be automated tests for the forms that matter most?
- Who will maintain it after launch?
Our founder worked in support at Gravity Forms, so we have seen many of the ways custom form code goes wrong, and we build to avoid them.
Get help with Gravity Forms
If you need a custom integration, an add-on, or help fixing forms that keep breaking, see our Gravity Forms development service. We review what you have, explain the options, and give you a fixed quote. Contact us to start.
Frequently asked questions
- When do I need a Gravity Forms developer?
- You need one when the built-in settings and official add-ons cannot do what you need. Common examples are filling fields from your own data, custom validation rules, sending entries to a system with no ready-made add-on, and building a custom add-on.
- Can Gravity Forms send entries to my CRM?
- Often yes. Gravity Forms has official add-ons for many services and a Webhooks Add-On for others. When those are not enough, a developer can write a custom integration or a feed-based add-on.
- Will custom Gravity Forms code break when the plugin updates?
- It can if it relies on internal code. Custom work that uses the documented hooks, the GFAPI class and the Add-On Framework is much more stable, especially when it has automated tests run before each update.
- Is it better to use a Gravity Forms add-on or custom code?
- Use an official add-on when it does what you need. Custom code makes sense when no add-on fits, when you need several add-ons glued together, or when an off-the-shelf tool adds more weight than value.