Taxonomy Custom Column – ‘manage_{TAXONOMY}_custom_column’ filter only passing 2 arguments

I am trying to add a custom column to the tables shown on the Tags & Categories admin pages in WordPress.

I have created a function, and added it as a filter using

Read More
add_filter( 'manage_post_tag_custom_column' , 'my_custom_column' , 10 , 2 );

My function is

my_custom_column( $out , $name , $term_id ){
  switch( $name ){
    case 'my_column_slug' :
      echo '<pre>';var_dump( func_get_args() );echo '</pre>';
      break;
  }
}

My column is shown in the table, with the <pre>...</pre> content, but it seems that no $term_id is being passed to my function.

array(2) {
  [0]=>
  string(0) ""
  [1]=>
  string(12) "my_column_slug"
}

I have referred to a number of resources to confirm that there should be three arguments passed to the function (including this StackExchange article). Am I missing something here?

Related posts

Leave a Reply

1 comment

  1. You are using wrong number of arguments in add_filter, you specified to get 2 arguments and you are looking for third one:

    Update your add_filter code to this:

    add_filter( 'manage_post_tag_custom_column' , 'my_custom_column' , 10 , 3 );
    

    The 3 in the end tells the filter to provide all the three arguments to your function.