Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#14724 closed defect (bug) (invalid)

manage_$(taxonomy)_custom_column limits plugin interaction

Reported by: nerrad Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords: close
Focuses: Cc:


Having trouble coming up with a descriptive title.

Here's the problem:

I have one plugin that creates a custom taxonomy ('series') and I can populate the new column on the 'edit-tags?taxonomy=series' page fine (named 'icon'). For this plugin I use the 'manage_series_custom_column' filter to add in the content for that column. For example:

function my_first_plugin_column($unknown, $column_name, $id) {
    if ($column_name == 'icon') {
       $data = get_some_data();
       $return $data;

This works as expected and I see the column 'Series' with it's content.

Here's the problem. I've created an "addon" for my original plugin that also hooks into the table on the 'edit-tags.php?taxonomy=series' page. I've successfully created the "group" column and it sets up the column correctly. Then I hook into the custom column filter like so:

function my_second_plugin_column($unknown, $column_name, $id) {
    if ( $column_name == 'group' ) {
       $data = get_some_data();
       $return $data;

The PROBLEM is that the data for the second plugin DOES NOT display. Funny thing is when I do a var_dump on the data it is there. But somehow it's getting lost in the apply_filter() routine. I've also tried playing around with the priority. Whichever custom_column is given the higher priority is the one that will display and the other one won't.

Am I missing something?

Change History (4)

#1 @nacin
5 years ago

  • Keywords close added

Assuming $return is a typo, the problem is that the first parameter isn't unknown, but rather it is the value of the filter. By default, there are no custom columns, and thus it is empty. But you need to concatenate the first variable with what you want to add to it, and return all of that. And you still need to always return data -- if column name doesn't equal group, then no data will get returned, and that'll screw things up pretty well. (The final aspect is probably what is hiding the first column.)

#2 @nerrad
5 years ago

  • Resolution set to fixed
  • Status changed from new to closed

$return was a typo in the example above but you pointed me in the right direction with concatenating the $content and returning it outside of the $column check. That was my problem. Sorry for the trouble.

#3 @nacin
5 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

No problem.

#4 @nacin
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.