Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#14004 closed defect (bug) (worksforme)

Custom columns for admin menu not working for custom post type with hierarchy

Reported by: cubehouse's profile cubehouse Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Posts, Post Types Keywords: post type hierarchical hierarchy columns
Focuses: Cc:

Description (last modified by dd32)

When enabling a custom post-type to be hierarchical:

$args = array(
...
	'hierarchical' => true
...
);

When trying to show custom columns, everything displays blank.
The columns themselves appear, but the data inside them do not.

By disabling hierarchical post types, all the date appears.

I.e, this action hook does not trigger when post type is hierarchical.

add_action('manage_posts_custom_column',  'my_show_columns');
function my_show_columns($name) {
    global $post;
    switch ($name) {
        case 'views':
            echo "Show something";
    }
}

Change History (4)

#1 follow-up: @dd32
15 years ago

  • Description modified (diff)

Off the top of my head, This may be because page_rows() is used to display hierarchical types (instead of post_rows())

Can you try using the page filter instead? (I'm thinking its 'manage_pages_custom_column'?)

#2 @scribu
15 years ago

  • Cc scribu@… added

#3 in reply to: ↑ 1 @cubehouse
15 years ago

Replying to dd32:

Off the top of my head, This may be because page_rows() is used to display hierarchical types (instead of post_rows())

Can you try using the page filter instead? (I'm thinking its 'manage_pages_custom_column'?)

Huzzah! You are most correct - there is so little documentation on this at the moment.

Not really sure what the change the bug status too now.

#4 @scribu
15 years ago

  • Milestone Unassigned deleted
  • Resolution set to worksforme
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.