I’ve done this with posts, but I can’t find the proper way to reference the category table’s columns.
I’m trying to add a column titled “Image” to the table, so that when the table grid of categories is displayed, if there is a category image assigned to the category, it will appear in the grid.
The first step for me is to determine the proper filter to address in order to insert the columb into the table.
I’ve tried each of these to no avail…
add_filter('manage_categories_columns', 'myFunction', 10, 2);
add_filter('manage_category_columns', 'myFunction', 10, 2);
function myFunction($cat_columns)
{
$cat_columns['cat_image_thumb'] = 'Image';
return $cat_columns;
}
The filter is
manage_{$screen->id}_columns
, and$screen->id
isedit-category
, giving youmanage_edit-category_columns
.I found this by placing a
var_dump()
inget_column_headers()
, which is called byprint_column_headers()
, which is called inwp-admin/edit-tags.php
, the page where you edit the category items.Adding the column name
Next we want to put the data in it:
I hope this was useful.
In addition to @LeoDang’s example, the custom_column is applied to custom taxonomy based on the following filters.
Tested and validated in WordPress 3.8
1.Adding Custom Column header
2.Adding Custom Column Data to corresponding Column Header
You may also refer to the gist code shared online for any update and additional notes.