Description
Use this filter to add/remove tabs to/form the main Gravity Forms settings page.
If 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
- $tabs array
An array of tabs to be filtered, in the following format:
array( array( 'name' => 'tab1', 'label' => 'Settings 1' ), array( 'name' => 'tab2', 'label' => 'Settings 2' ) )
Examples
1. Add 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; }
2. Remove tab
The following example shows how tabs can be removed. For add-ons which extend the offical 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 should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFSettings::page_header() in settings.php.