Our admin dashboard list of our custom post type shows by default two columns - title and categories.
We want to improve the list, and to add the foobar custom field. So we do that as follows:
add_action('manage_myproduct_posts_columns', 'manage_myproduct_posts_columns');
function manage_heatherproduct_posts_columns($post_columns) {
$_REQUEST['mode'] = 'excerpt';
$post_columns = array(
'cb' => $post_columns['cb'],
'title' => 'Product',
'categories' => 'Categories',
'myproduct_foobar' => 'foobar',
);
return $post_columns;
}
That shows the title and the foobar field fine (code which pulls in the foobar data not shown). But now, the categories column is semi-broken. One of the categories is shown, correctly, for those products which fit into that category. But none of the other categories ever show up. Instead we just see a dash.
What are we doing wrong?
NB. I've not included the code where we pull in the data for the custom column foobar as the category problem seems to occur even if we comment that out.