Using WordPress ‘install_plugins_nonmenu_tabs’ PHP filter

The install_plugins_nonmenu_tabs WordPress PHP Filter allows you to modify the tabs that are not associated with a menu item on the Add Plugins screen.

Usage

add_filter('install_plugins_nonmenu_tabs', 'my_custom_nonmenu_tabs');
function my_custom_nonmenu_tabs($nonmenu_tabs) {
    // your custom code here
    return $nonmenu_tabs;
}

Parameters

  • $nonmenu_tabs (string[]): The tabs that don’t have a menu item on the Add Plugins screen.

More information

See WordPress Developer Resources: install_plugins_nonmenu_tabs

Examples

Add a new non-menu tab

Add a new tab called ‘Custom Tab’ to the non-menu tabs on the Add Plugins screen.

add_filter('install_plugins_nonmenu_tabs', 'add_custom_nonmenu_tab');
function add_custom_nonmenu_tab($nonmenu_tabs) {
    $nonmenu_tabs[] = 'custom_tab';
    return $nonmenu_tabs;
}

Remove a specific non-menu tab

Remove the ‘Upload Plugin’ tab from the non-menu tabs on the Add Plugins screen.

add_filter('install_plugins_nonmenu_tabs', 'remove_upload_plugin_tab');
function remove_upload_plugin_tab($nonmenu_tabs) {
    if (($key = array_search('upload-plugin', $nonmenu_tabs)) !== false) {
        unset($nonmenu_tabs[$key]);
    }
    return $nonmenu_tabs;
}

Remove all non-menu tabs

Remove all non-menu tabs from the Add Plugins screen.

add_filter('install_plugins_nonmenu_tabs', 'remove_all_nonmenu_tabs');
function remove_all_nonmenu_tabs($nonmenu_tabs) {
    return array();
}

Modify a specific non-menu tab

Rename the ‘Upload Plugin’ tab to ‘New Upload Plugin’ in the non-menu tabs on the Add Plugins screen.

add_filter('install_plugins_nonmenu_tabs', 'rename_upload_plugin_tab');
function rename_upload_plugin_tab($nonmenu_tabs) {
    if (($key = array_search('upload-plugin', $nonmenu_tabs)) !== false) {
        $nonmenu_tabs[$key] = 'new_upload_plugin';
    }
    return $nonmenu_tabs;
}

Display non-menu tabs in reverse order

Display the non-menu tabs on the Add Plugins screen in reverse order.

add_filter('install_plugins_nonmenu_tabs', 'reverse_nonmenu_tabs');
function reverse_nonmenu_tabs($nonmenu_tabs) {
    return array_reverse($nonmenu_tabs);
}