Using Gravity Forms ‘gform_settings_save_button’ PHP filter

The gform_settings_save_button is a Gravity Forms filter that allows you to modify the HTML of the Save button within Gravity Forms Settings.

Usage

add_filter('gform_settings_save_button', 'modify_gform_settings_save_button', 10, 1);

function modify_gform_settings_save_button($html) {
  // your custom code here
  return $html;
}

Parameters

  • $html (string): This parameter holds the HTML markup for the Save button.

More Information

See Gravity Forms Docs: gform_settings_save_button

This filter is located in GFSettings::page_header() in settings.php. You should place this code in the functions.php file of your active theme.

Examples

Change Button Text

In this example, we’ll change the text of the Save button to “Submit Changes”.

function modify_gform_settings_save_button($html) {
  $html = str_replace('Save', 'Submit Changes', $html);
  return $html;
}

Change Button Color

We’ll modify the CSS to change the button color to red.

function modify_gform_settings_save_button($html) {
  $html = str_replace('class="', 'class="red-button ', $html);
  return $html;
}

Add Custom ID

We’ll add a custom ID to the button for further customization with CSS or JavaScript.

function modify_gform_settings_save_button($html) {
  $html = str_replace('id="gform-settings-save"', 'id="gform-settings-save custom-id"', $html);
  return $html;
}

Add Additional Attribute

We’ll add a custom attribute to the button (data-custom=”value”).

function modify_gform_settings_save_button($html) {
  $html = str_replace('<button', '<button data-custom="value"', $html);
  return $html;
}

Hide Button

We’ll hide the button using a style attribute.

function modify_gform_settings_save_button($html) {
  $html = str_replace('<button', '<button style="display:none;"', $html);
  return $html;
}