gform_settings_menu

Description

The gform_settings_menu filter allows developers to add or remove tabs from the main Gravity Forms settings page.

Note: If you are creating a Gravity Forms Add-On, consider using the Add-On Framework instead as it provides many other features.

Usage

add_filter( 'gform_settings_menu', 'add_custom_settings_tab' );

Parameters

ParameterTypeDescription
$tabsarrayAn array of tabs to be filtered.

The array is in the following format:

array(
	array( 'name' => 'tab1', 'label' => 'Settings 1' ),
	array( 'name' => 'tab2', 'label' => 'Settings 2' )
)

Examples

Add a tab.

The following example demonstrates how to add a custom settings tab.

add_filter( 'gform_settings_menu', 'add_custom_settings_tab' );
function add_custom_settings_tab( $tabs ) {
	$tabs[] = array( 'name' => 'my_tab', 'label' => 'My Settings' );
	return $tabs;
}

Remove a tab.

The following example shows how tabs can be removed. For add-ons which extend the official Gravity Forms add-on framework the tab name will be the add-on slug.

add_filter( 'gform_settings_menu', function ( $tabs ) {
	$remove_names = array(
		'gravityformsuserregistration',
	);

	foreach ( $tabs as $key => $tab ) {
		if ( in_array( $tab['name'], $remove_names ) ) {
			unset( $tabs[ $key ] );
		}
	}

	return $tabs;
} );

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?

Source Code

This filter is located in GFSettings::page_header() in settings.php.