How to add a column to taxonomy overview page?

How to add a column to taxonomy overview page?

The 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

If I can be of assistance, please do not hesitate to contact me.

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.

You may also like

Out of Stock feature in Drupal Commerce 2.x

Implementing Out of Stock feature in Drupal Commerce 2.x is easy. Unfortunately, you can't just enable this feature, because Commerce doesn't support it out of the box. You have to get your hands dirty and write some code.