Using Gravity Forms ‘gform_addon_app_settings_menu_{$SHORT_SLUG}’ PHP filter

The gform_addon_app_settings_menu_{$SHORT_SLUG} filter in Gravity Forms allows you to control the addition or removal of tabs within the Gravity Forms settings menu.

Usage

To add a settings tab and determine the callback for a specific slug:

add_filter('gform_addon_app_settings_menu_{$SHORT_SLUG}', 'your_function_name');

For the Mailchimp add-on:

add_filter('gform_addon_app_settings_menu_mailchimp', 'your_function_name');

For the 2Checkout add-on:

add_filter('gform_addon_app_settings_menu_2checkout', 'your_function_name');

Parameters

  • $settings_tabs (array): Controls each of the tabs and their callbacks.

More information

See Gravity Forms Docs: gform_addon_app_settings_menu_{$SHORT_SLUG} Place the code in the functions.php file of your active theme. The filter is located in class-gf-addon.php.

Examples

Add a custom settings tab

Add a custom settings tab called “Custom Tab” for the Mailchimp add-on:

function add_custom_tab($tabs) {
    $tabs['custom_tab'] = array(
        'label' => 'Custom Tab',
        'callback' => 'custom_tab_callback',
    );
    return $tabs;
}
add_filter('gform_addon_app_settings_menu_mailchimp', 'add_custom_tab');

function custom_tab_callback() {
    // your custom code here
}

Remove a specific settings tab

Remove the “Settings” tab for the 2Checkout add-on:

function remove_settings_tab($tabs) {
    unset($tabs['settings']);
    return $tabs;
}
add_filter('gform_addon_app_settings_menu_2checkout', 'remove_settings_tab');

Rename a tab

Rename the “Settings” tab to “Options” for the Mailchimp add-on:

function rename_settings_tab($tabs) {
    $tabs['settings']['label'] = 'Options';
    return $tabs;
}
add_filter('gform_addon_app_settings_menu_mailchimp', 'rename_settings_tab');

Change the callback function for a tab

Change the callback function for the “Settings” tab of the Mailchimp add-on:

function change_callback($tabs) {
    $tabs['settings']['callback'] = 'new_callback_function';
    return $tabs;
}
add_filter('gform_addon_app_settings_menu_mailchimp', 'change_callback');

function new_callback_function() {
    // your custom code here
}

Reorder tabs

Reorder the tabs for the 2Checkout add-on by moving the “Settings” tab to the end:

function reorder_tabs($tabs) {
    $settings_tab = $tabs['settings'];
    unset($tabs['settings']);
    $tabs['settings'] = $settings_tab;
    return $tabs;
}
add_filter('gform_addon_app_settings_menu_2checkout', 'reorder_tabs');