How to add a column to taxonomy overview page?

How to add a column to taxonomy overview page?

Taxonomy overview page is not a listing of entities built with the entity list builder, and it's not a View. It's just a regular form, and that means that we can use the form_alter() hook to include additional columns.

Let's see how to add a new column named Status:

 * Implements hook_form_ID_alter().
function MODULE_NAME_form_taxonomy_overview_terms_alter(&$form, FormStateInterface $formState) {
  $form['terms']['#header'] = array_merge(array_slice($form['terms']['#header'], 0, 1, TRUE),
    array_slice($form['terms']['#header'], 1, NULL, TRUE));

  foreach ($form['terms'] as &$term) {
    if (is_array($term) && !empty($term['#term'])) {
      $status['status'] = [
        '#markup' => ($term['#term']->status->value) ? t('Published') : t('Unpublished'),
        '#type' => 'item',

      $term = array_slice($term, 0, 1, TRUE) +
        $status +
        array_slice($term, 1, NULL, TRUE);

I didn't write this code myself, but since it is very useful I'm sharing it here. I found it in the Thunder's Taxonomy module.

Before altering:

Taxonomy overview page - before
Taxonomy overview page - before

After altering:

Taxonomy overview page - after
Taxonomy overview page - after

About the author

Goran Nikolovski is a highly experienced Drupal developer with an extensive skill set that includes PHP, MySQL, HTML, CSS and Javascript. He has experience with large Drupal sites and Drupal Commerce 2.x integration, and he is author of several Drupal modules.