The gform_enable_legacy_markup filter can be used to enable the legacy markup for forms created with Gravity Forms 2.5 and greater.
Usage
add_filter('gform_enable_legacy_markup', 'your_function_name', 10, 2);
To specify this per form, add the form ID after the filter name:
add_filter('gform_enable_legacy_markup_6', 'your_function_name', 10, 2);
Parameters
- $is_enabled (boolean): Indicates if legacy markup is enabled for the current form. Default is false for forms created with Gravity Forms 2.5 and greater.
- $form (Form Object): The current form object.
More information
See Gravity Forms Docs: gform_enable_legacy_markup
Examples
Enable legacy markup for all forms
Enable legacy markup for all forms by returning true:
add_filter('gform_enable_legacy_markup', '__return_true');
Disable legacy markup for all forms
Disable legacy markup for all forms by returning false:
add_filter('gform_enable_legacy_markup', '__return_false');
Enable legacy markup for a specific form
Enable legacy markup only for form ID 6:
add_filter('gform_enable_legacy_markup_6', '__return_true');
Enable legacy markup for forms based on a condition
Enable legacy markup for forms with a specific title:
function enable_legacy_markup_for_title($is_enabled, $form) { return $form['title'] == 'Special Form' ? true : $is_enabled; } add_filter('gform_enable_legacy_markup', 'enable_legacy_markup_for_title', 10, 2);
Disable legacy markup for forms based on a condition
Disable legacy markup for forms with a specific title:
function disable_legacy_markup_for_title($is_enabled, $form) { return $form['title'] == 'Modern Form' ? false : $is_enabled; } add_filter('gform_enable_legacy_markup', 'disable_legacy_markup_for_title', 10, 2);