WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#18996 closed defect (bug) (invalid)

$term_id parameter not passed on "manage_{my_taxonomy}_custom_column"

Reported by: magicfrog Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: needs-patch
Focuses: Cc:

Description

To add an extra column in my custom taxonomy listing, seems i'm supposed to do this :

add_action('manage_mytaxonomy_custom_column', 'manage_mytaxonomy_columns', 10, 2);
function manage_mytaxonomy_columns($empty='', $column_name, $term_id){
    switch ($column_name){
        case 'logo':
	    $terms = get_the_terms($term_id, 'mytaxonomy');
...

But with this i get :
Warning: Missing argument 3 for manage_mytaxonomy_columns()

As info, the column is visible, its title too. The problem only concerns the value renderer.
(I've also added custom columns on a custom post type grid andit works perfectly there)

My purpose is to display a custom logo associated with each record, but to do so, i need to get the id of each record... i might be wrong , thanx to let me know if i'm supposed to do that another way.

Change History (3)

comment:1 magicfrog2 years ago

I forgot to precise i'm using WP 3.2.1

comment:2 SergeyBiryukov2 years ago

A correct call would be:

add_filter('manage_mytaxonomy_custom_column', 'manage_mytaxonomy_columns', 10, 3);

Note the last parameter, which is the number of arguments accepted by the function.
Also, it's a filter, not an action.

comment:3 dd322 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

As Sergey points out, Specify that the filter is going to receive 3 params (not 2 like your code example specifies) and it should work.

Re-open if I've mis understood. (Please note: You can add comments to a closed ticket without re-opening it as well)

Note: See TracTickets for help on using tickets.