Posted on January 17, 2013 by Curtis McHale

WordPress 3.5 – Easy Taxonomy Admin Columns

Until WordPress 3.5, if you wanted to see your custom taxonomy admin columns on your Custom Post Types (like you see Categories and Tags on Posts) you had to build them yourself. I showed you how to add a column to the WordPress Users admin column already. If you wanted taxonomies you had to go through a similar process.

Not so with WordPress 3.5 and an addition to register_taxonomy.

If you’d rather watch a screencast, jump to the bottom.


With 3.5 we now have an extra argument on register_taxonomy called show_admin_column. show_admin_column takes either true/false argument. true means show the shiny new admin column false means don’t show it. show_admin_column defaults to false.

Now let’s register a taxonomy and see our new admin column. We’re going to add a new taxonomy called ‘Custom’ to our posts. I often use a taxonomy like this to allow clients to add a post to a featured post slider on their homepage.

We start by defining a class for our plugin.

Plugin Name: WPTT Screencast Plugin
Plugin URI:
Description: Just the plugin holder I keep around for screencasts
Version: 1.0
Author: WP Theme Tutorial, Curtis McHale
Author URI:
License: GPLv2 or later

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

class WPTT_Screencast{

  function __construct(){

  } // __construct

} // WPTT_Screencast

$wptt_screencast = new WPTT_Screencast();

If you’re not sure why I’m using a Class then you need to read 2 posts:

  1. How to Write a Basic WordPress Plugin
  2. Using Classes as Code Wrappers for WordPress Plugins

Now that we have a basic class set, we can add our taxonomy to it.

class WPTT_Screencast{

  function __construct(){
    add_action( 'init', array( $this, 'register_tax' ), 0 );
  } // construct

   * Registers our custom taxonomies for the site.
   * @uses    register_taxonomy     Registers a custom taxonomy given args
   * @access  public
   * @return  void
   * @since   1.0
   * @author  WP Theme Tutorial, Curtis McHale
  public function register_tax(){

    // Add new taxonomy, make it hierarchical (like categories)
    $labels = array(
      'name'              => _x( 'Custom', 'taxonomy general name' ),
      'singular_name'     => _x( 'Custom', 'taxonomy singular name' ),
      'search_items'      => __( 'Search Custom' ),
      'all_items'         => __( 'All Custom' ),
      'parent_item'       => __( 'Parent Custom' ),
      'parent_item_colon' => __( 'Parent Custom:' ),
      'edit_item'         => __( 'Edit Custom' ),
      'update_item'       => __( 'Update Custom' ),
      'add_new_item'      => __( 'Add New Custom' ),
      'new_item_name'     => __( 'New Custom Name' ),
      'menu_name'         => __( 'Custom' ),

    register_taxonomy( 'custom', array( 'post' ), array(
      'hierarchical'      => true,
      'labels'            => $labels,
      'show_ui'           => true,
      //'show_admin_column' => true, // here is our new admin column argument
      'query_var'         => true,
      'rewrite'           => array( 'slug' => 'custom' ),

  } // register_tax

} // WPTT_Screencast

$wptt_screencast = new WPTT_Screencast();

As you can see in this code snippet I have commented out the new show_admin_column argument. So we can see the taxonomy in our WordPress sidebar, but there is no column.

Custom Taxonomy no Column

Now let’s uncomment the show_admin_column argument and take another look.

Custom Taxonomy with Column