I have the following code to add a new column to my taxonomy edit screen (edit-tags.php?taxonomy=book_place&post_type=books)

function add_book_place_columns( $columns ) {
    $columns['foo'] = 'Foo';
    return $columns;
add_filter( 'manage_edit-book_place_columns', 'add_book_place_columns' );

function add_book_place_column_content( $content ) {
    content = 'test';
    return $content;
add_filter( 'manage_book_place_custom_column', 'add_book_place_column_content' );

It's working, but I need to access the current term id in the add_book_place_column_content function. How can I do that?

1 Answer 1


The manage_{TAXONOMY}_custom_column filter hook passes 3 arguments:

  • $content
  • $column_name
  • $term_id

So try this:

function add_book_place_column_content( $content, $column_name, $term_id ) {
    $term= get_term( $term_id, 'book_place' );
    switch ( $column_name ) {
        case 'foo':
            // Do your stuff here with $term or $term_id
            $content = 'test';

    return $content;

add_filter( 'manage_book_place_custom_column', 'add_book_place_column_content', 10, 3 );
  • For those, who like me, might miss it - the 10, 3 are key. 10 is priority and 3 is number of arguments. If you don't put the 3 it only passes the first argument - no term it. If using a class: add_filter('manage_CUSTOMTAX_custom_column', array($this, 'handler_function'), 10, 3);
    – Kropotkin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.