The install_themes_nonmenu_tabs WordPress PHP Filter allows you to modify the tabs that are not associated with a menu item on the Install Themes screen.
Usage
add_filter('install_themes_nonmenu_tabs', 'your_custom_function');
function your_custom_function($nonmenu_tabs) {
// your custom code here
return $nonmenu_tabs;
}
Parameters
- $nonmenu_tabs (string[]): The tabs that don’t have a menu item on the Install Themes screen.
More information
See WordPress Developer Resources: install_themes_nonmenu_tabs
Examples
Add a Custom Non-Menu Tab
This example adds a custom non-menu tab called “My Custom Tab” to the Install Themes screen.
add_filter('install_themes_nonmenu_tabs', 'add_custom_nonmenu_tab');
function add_custom_nonmenu_tab($nonmenu_tabs) {
$nonmenu_tabs[] = 'my_custom_tab';
return $nonmenu_tabs;
}
Remove a Non-Menu Tab
This example removes a specific non-menu tab from the Install Themes screen.
add_filter('install_themes_nonmenu_tabs', 'remove_nonmenu_tab');
function remove_nonmenu_tab($nonmenu_tabs) {
$key = array_search('tab_to_remove', $nonmenu_tabs);
if ($key !== false) {
unset($nonmenu_tabs[$key]);
}
return $nonmenu_tabs;
}
Reorder Non-Menu Tabs
This example reorders the non-menu tabs on the Install Themes screen.
add_filter('install_themes_nonmenu_tabs', 'reorder_nonmenu_tabs');
function reorder_nonmenu_tabs($nonmenu_tabs) {
$new_order = array('tab1', 'tab3', 'tab2');
$nonmenu_tabs = array_intersect($new_order, $nonmenu_tabs);
return $nonmenu_tabs;
}
Add Multiple Custom Non-Menu Tabs
This example adds multiple custom non-menu tabs to the Install Themes screen.
add_filter('install_themes_nonmenu_tabs', 'add_multiple_custom_nonmenu_tabs');
function add_multiple_custom_nonmenu_tabs($nonmenu_tabs) {
$custom_tabs = array('custom_tab1', 'custom_tab2', 'custom_tab3');
$nonmenu_tabs = array_merge($nonmenu_tabs, $custom_tabs);
return $nonmenu_tabs;
}
Clear All Non-Menu Tabs
This example clears all non-menu tabs from the Install Themes screen.
add_filter('install_themes_nonmenu_tabs', 'clear_all_nonmenu_tabs');
function clear_all_nonmenu_tabs($nonmenu_tabs) {
$nonmenu_tabs = array();
return $nonmenu_tabs;
}