Adding a custom column works for the user list, but not for the custom post type

Adding a custom column works for the user list, but not for the custom post type

I’m trying to add a column to the post list for my custom post type, board game. I know it’s post_type board game because that’s what it shows when I show it All board games in the left navigation

/wp-admin/edit.php?post_type=boardgame

However, nothing I do seems to cause a new column to appear. To make sure my code was correct, I added this snippet to my function.php.

function custom_cpt_columns( $columns ) {
    $columns['GRRRR'] = 'GRRRR'; // Add your column
    return $columns;
}
add_filter('manage_users_columns', 'custom_cpt_columns'); 

I’m reloading /wp-admin/users.php and yes, there is the new column.

So I change the filter name to manage_boardgame_columns and shit, nothing.

function custom_cpt_columns( $columns ) {
    $columns['GRRRR'] = 'GRRRR'; // Add your column
    return $columns;
}
add_filter('manage_boardgame_columns', 'custom_cpt_columns'); 

Edit list for WordPress board games

I tried it board games, board game, board games and none of them work. I pull my hair out because it should be so easy. But for some reason it doesn’t work. I put this new code at the very end of my theme’s functions.php to make sure nothing else can interfere with it. But still nothing. I added a simple echo statement to the function and confirmed that when editing the user admin columns, the echo statement appears in the source code, but not when editing the board game list.

That seems to indicate that I don’t have the post_type correct, but I’m literally copying it from the admin edit list URL for that post type.

What am I missing?

#Adding #custom #column #works #user #list #custom #post #type

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *