The install_themes_tabs WordPress PHP Filter allows you to modify the tabs displayed on the Add Themes screen, mainly used for backward compatibility or hiding the upload tab.
Table of contents
Usage
add_filter('install_themes_tabs', 'my_custom_theme_tabs');
function my_custom_theme_tabs($tabs) {
// your custom code here
return $tabs;
}
Parameters
- $tabs (string[]): An associative array of the tabs shown on the Add Themes screen. Default is
'upload'.
More information
See WordPress Developer Resources: install_themes_tabs
Examples
Remove the Upload Tab
Remove the upload tab from the Add Themes screen.
add_filter('install_themes_tabs', 'remove_upload_tab');
function remove_upload_tab($tabs) {
unset($tabs['upload']);
return $tabs;
}
Add a Custom Tab
Add a custom tab to the Add Themes screen.
add_filter('install_themes_tabs', 'add_custom_tab');
function add_custom_tab($tabs) {
$tabs['custom'] = __('Custom Tab', 'text-domain');
return $tabs;
}
Rearrange Tabs Order
Change the order of the tabs on the Add Themes screen.
add_filter('install_themes_tabs', 'rearrange_tabs_order');
function rearrange_tabs_order($tabs) {
// Rearrange the order of tabs
return array(
'upload' => $tabs['upload'],
'custom' => __('Custom Tab', 'text-domain')
);
}
Change the Label of the Upload Tab
Modify the label of the upload tab on the Add Themes screen.
add_filter('install_themes_tabs', 'change_upload_label');
function change_upload_label($tabs) {
$tabs['upload'] = __('New Label', 'text-domain');
return $tabs;
}
Add Multiple Custom Tabs
Add multiple custom tabs to the Add Themes screen.
add_filter('install_themes_tabs', 'add_multiple_custom_tabs');
function add_multiple_custom_tabs($tabs) {
$tabs['custom1'] = __('Custom Tab 1', 'text-domain');
$tabs['custom2'] = __('Custom Tab 2', 'text-domain');
return $tabs;
}