Using WordPress ‘install_plugins_tabs’ PHP filter

The install_plugins_tabs WordPress PHP Filter modifies the tabs displayed on the Add Plugins screen in the WordPress admin area.

Usage

add_filter('install_plugins_tabs', 'your_custom_function_name');
function your_custom_function_name($tabs) {
  // your custom code here
  return $tabs;
}

Parameters

  • $tabs (string[]): The array of tabs displayed on the Add Plugins screen. Default tabs include ‘featured’, ‘popular’, ‘recommended’, ‘favorites’, and ‘upload’.

More information

See WordPress Developer Resources: install_plugins_tabs

Examples

Add a Custom Tab

Add a custom tab named “My Custom Tab” to the Add Plugins screen.

add_filter('install_plugins_tabs', 'add_my_custom_tab');
function add_my_custom_tab($tabs) {
  $tabs['my_custom_tab'] = 'My Custom Tab';
  return $tabs;
}

Remove the ‘Featured’ tab from the Add Plugins screen.

add_filter('install_plugins_tabs', 'remove_featured_tab');
function remove_featured_tab($tabs) {
  unset($tabs['featured']);
  return $tabs;
}

Rearrange the Tabs

Rearrange the order of tabs on the Add Plugins screen.

add_filter('install_plugins_tabs', 'rearrange_tabs');
function rearrange_tabs($tabs) {
  $new_tabs = array(
    'favorites'   => $tabs['favorites'],
    'recommended' => $tabs['recommended'],
    'popular'     => $tabs['popular'],
    'featured'    => $tabs['featured'],
    'upload'      => $tabs['upload']
  );
  return $new_tabs;
}

Change Tab Labels

Update the labels of the ‘Featured’ and ‘Popular’ tabs.

add_filter('install_plugins_tabs', 'change_tab_labels');
function change_tab_labels($tabs) {
  $tabs['featured'] = 'Top Picks';
  $tabs['popular'] = 'Trending';
  return $tabs;
}

Hide All Tabs Except ‘Upload’

Show only the ‘Upload’ tab on the Add Plugins screen.

add_filter('install_plugins_tabs', 'show_upload_tab_only');
function show_upload_tab_only($tabs) {
  return array('upload' => $tabs['upload']);
}