How to get the Admin List column names
-
I have been able to add and populate columns in the Admin List for a custom post type. No problem there. However, the yoast plugin has populated the screen with a bunch of columns we want to get rid of. I’m fully aware that we can use Screen Options to hide them. That’s not what we want to do. I’ve found on the forums how to delete columns.
function my_columns_filter( $columns ) { unset($columns['author']); unset($columns['tags']); unset($columns['categories']); unset($columns['tags']); unset($columns['comments']); return $columns; } add_filter( 'manage_edit-post_columns', 'my_columns_filter', 10, 1 ); You can use this with custom post types by adjusting the filter like so: manage_edit-%customposttype%_columns
How do I delete a column when I don’t know its “name”? To get rid of the yoast columns, what do I use instead of ‘author’?
unset($columns[‘author’]);
How do I find what a column’s name to unset it? I can see the name on sortable columns in the path but not on columns that are not sortable.
- The topic ‘How to get the Admin List column names’ is closed to new replies.