Gravity Forms
A dropdown that lists all forms created in Gravity Forms. Lets editors pick which form to embed or associate with a post or option page — no shortcode copy-pasting required. Requires Gravity Forms to be installed and active.
Plugin dependency
This field only appears and functions when Gravity Forms is installed and active. If Gravity Forms is deactivated, the field dropdown will be empty.
Settings
| Setting | Default | Options | Description |
|---|---|---|---|
| Return Format | id | id · form | id returns the numeric form ID. form returns the complete form meta array from GFFormsModel::get_form_meta(). |
Return values
return_format: 'id'
Returns the Gravity Forms form ID as an integer.
$form_id = get_field('contact_form');
// 3
return_format: 'form'
Returns the full form meta array.
$form = get_field('contact_form');
// ['id' => 3, 'title' => 'Contact Us', 'fields' => [...], ...]
$title = $form['title'];
Usage
Rendering with gravity_form() helper
$form_id = get_field('page_form');
if ($form_id) {
gravity_form($form_id, true, true, false, null, true);
// id title ajax tabindex atts echo
}
Rendering via shortcode
$form_id = get_field('page_form');
if ($form_id) {
echo do_shortcode('[gravityform id="' . intval($form_id) . '" title="false" ajax="true"]');
}
Displaying the form title
$form = get_field('contact_form'); // return_format: 'form'
if ($form) {
echo '<h3 class="form-title">' . esc_html($form['title']) . '</h3>';
gravity_form($form['id'], false, true, false, null, true);
}
Conditional form display
$form_id = get_field('lead_capture_form');
if ($form_id && is_user_logged_out()) {
gravity_form($form_id, false, true);
} else {
echo '<p>You are already subscribed.</p>';
}