Support » Fixing WordPress » Add ID column to custom taxonomy admin display

  • Resolved David Gard


    Hey all,

    Trying to write a plugin for my site that will display the ID for terms in a custom taxonomy, along with all the other bits. I can do this with Posts/Pages/etc using the code below, but I don’t know of any filters or actions to do this to the custom taxonomies – is any body able to help at all?

    Also looking to remove the description, but that should be pretty easy providing the hooks exist!


    add_filter('manage_posts_columns', 'riv_posts_columns', 5);
    add_action('manage_posts_custom_column', 'riv_posts_custom_columns', 5, 2);
Viewing 9 replies - 1 through 9 (of 9 total)
  • I have no idea if this will help or not? Here’s the code I use to add and remove stuff for a custom post type called ve_products, with a custom taxonomy of product_category. I’m just hoping maybe you can use some of it?

    add_filter("manage_edit-ve_products_columns", "prod_edit_columns");
    add_action("manage_posts_custom_column",  "prod_custom_columns");   
    function prod_edit_columns($columns){
            $columns = array(
                "cb" => "<input type=\"checkbox\" />",
                "title" => "Product Title",
                "description" => "Description",
                "prod_cat" => "Product Category",
            return $columns;
    function prod_custom_columns($column){
            global $post;
            switch ($column)
                case "description":
                case "prod_cat":
                    echo get_the_term_list($post->ID, 'product_category', '', ', ','');

    Updated response:
    For modifying the taxonomy page data.


    add_filter( 'manage_edit-FOO_columns', 'your_function_name' );
    add_filter( 'manage_FOO_custom_column', 'your_function_name_two' );

    Where FOO should be your taxonomy name..

    The first will hook onto the heading’s for the taxonomy page, the second will hook onto the column to do whatever you want…

    You can find both hooks in wp-admin/includes/template.php, the first in the get_column_headers() function and the second in the _tag_row() function..

    Hope that helps… 🙂

    Not exactly what I’m after but very helpful as I was going to be looking at doing this next.

    Thanks for your input.

    Have updated my above response. Both the provided hooks will allow you to modify the taxonomy table heading and column data… 😉

    Mark, thanks very much – will play with that first thing tomorrow!

    How did the code work out? I did test the hooks briefly so they should be appropriate..

    NOTE: Both post types and taxonomies share a common hook naming scheme for the table column data, but differ slightly for the table heading..

    Table headers on post type screen


    Table headers on taxonomy type screen


    Table columns on both post type or taxonomy pages.


    Where {type} is the applicable taxonomy or post_type name.

    Hey Mark,

    Sorry for not coming back earlier, hectic day! Have now tried and it works a treat, with a couple of slight alterations, as below –

    add_filter('manage_edit-news_type_columns', 'riv_news_type_columns'5
    add_action('manage_news_type_custom_column', 'riv_news_type_custom_columns', 5, 3);

    Basically I just needed to add the $priority and $accepted_args arguments, as you need 3 arguments to get the ID and the default is just 1. Also, manage_news_type_custom_column should be called as an action not a filter.

    Full code below for a taxonomy called news_type –

    add_filter('manage_edit-news_type_columns', 'riv_news_type_columns', 5);
    add_action('manage_news_type_custom_column', 'riv_news_type_custom_columns', 5, 3);
    function riv_news_type_columns($defaults) {
    	$defaults['riv_news_type_ids'] = __('ID');
    	return $defaults;
    function riv_news_type_custom_columns($value, $column_name, $id) {
    	if( $column_name == 'riv_news_type_ids' ) {
    		return (int)$id;

    Thanks very much for the help.

    Also, manage_news_type_custom_column should be called as an action not a filter.

    Well using an action may work (maybe filters work as actions to), but the hook that you’re using looks like this..

    $out .= apply_filters("manage_${taxonomy}_custom_column", '', $column_name, $tag->term_id);

    I’d previously had interpreted that as being a filter hook, and an action hook typically looking like this..

    do_action( 'whatever' );

    Perhaps they work as either in some cases… 🙂

    I think your right, but did try it as a filter first time and didn’t work for me so though it worth mentionin. I’m hoping to do some more reading on actions and filters as they are extremely useful tbh.


Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Add ID column to custom taxonomy admin display’ is closed to new replies.