The manage_taxonomies_for_{$post_type}_columns WordPress PHP filter allows you to modify the taxonomy columns displayed in the Posts list table for a specific post type.
Usage
add_filter('manage_taxonomies_for_post_columns', 'custom_taxonomy_columns', 10, 2);
function custom_taxonomy_columns($taxonomies, $post_type) {
// your custom code here
return $taxonomies;
}
Parameters
$taxonomies(string[]): Array of taxonomy names to show columns for.$post_type(string): The post type.
More information
See WordPress Developer Resources: manage_taxonomies_for_{$post_type}_columns
Examples
Add a custom taxonomy column for ‘post’ post type
Add a custom taxonomy called ‘colors’ to the ‘post’ post type columns:
add_filter('manage_taxonomies_for_post_columns', 'add_colors_taxonomy_column', 10, 2);
function add_colors_taxonomy_column($taxonomies, $post_type) {
$taxonomies[] = 'colors';
return $taxonomies;
}
Remove category column for ‘post’ post type
Remove the ‘category’ column from the ‘post’ post type columns:
add_filter('manage_taxonomies_for_post_columns', 'remove_category_column', 10, 2);
function remove_category_column($taxonomies, $post_type) {
unset($taxonomies['category']);
return $taxonomies;
}
Add multiple custom taxonomy columns for ‘page’ post type
Add custom taxonomies ‘genres’ and ‘languages’ to the ‘page’ post type columns:
add_filter('manage_taxonomies_for_page_columns', 'add_custom_taxonomy_columns', 10, 2);
function add_custom_taxonomy_columns($taxonomies, $post_type) {
$taxonomies[] = 'genres';
$taxonomies[] = 'languages';
return $taxonomies;
}
Remove all taxonomy columns for ‘post’ post type
Remove all taxonomy columns from the ‘post’ post type:
add_filter('manage_taxonomies_for_post_columns', 'remove_all_taxonomy_columns', 10, 2);
function remove_all_taxonomy_columns($taxonomies, $post_type) {
return [];
}
Remove specific taxonomy column based on post type
Remove ‘tags’ column for ‘post’ post type and ‘category’ column for ‘page’ post type:
add_filter('manage_taxonomies_for_post_columns', 'remove_specific_taxonomy_column', 10, 2);
add_filter('manage_taxonomies_for_page_columns', 'remove_specific_taxonomy_column', 10, 2);
function remove_specific_taxonomy_column($taxonomies, $post_type) {
if ($post_type === 'post') {
unset($taxonomies['post_tag']);
} elseif ($post_type === 'page') {
unset($taxonomies['category']);
}
return $taxonomies;
}