Powered by Blogger.

How to add a custom column to your taxonomy terms list


In the taxonomy edit page maybe you want to show more column with some data related to the taxonomy term. Here is the way to add a column to taxonomy.

1. Add a new column to taxonomy terms list


function waytowp_add_custom_column_to_terms_list( $columns ){
        $columns['your_custom_column'] = 'Your Custom Column';
        
        return $new_columns;    
    }
    add_filter( 'manage_edit-{YOUR-TAXONOMY}_columns', 'waytowp_add_custom_column_to_terms_list' );

2. Show value for the column

function waytowp_show_custom_column_value( $deprecated,$column_name,$term_id ){
        if( $column_name == 'your_custom_column' ){
            echo 'Term ID:'.$term_id;
        }
    }
add_filter('manage_{YOUR-TAXONOMY}_custom_column', 'waytowp_show_custom_column_value', 10,3 );


No comments