Codex tools: Log in
Contents |
manage_${post_type}_posts_columns is a filter applied to the columns shown when listing posts of a custom type.
Note: Listed in order of appearance. By default, all columns supported by the post type are shown.
Post title.
Includes "edit", "quick edit", "trash" and "view" links. If $mode (set from $_REQUEST['mode']) is 'excerpt', a post excerpt is included between the title and links.
Suppose you have a 'books' custom post type and you want to add the publisher and book author in the edit page but remove the post author.
function add_book_columns($columns) {
unset($columns['author']);
return array_merge($columns,
array('publisher' => __('Publisher'),
'book_author' =>__( 'Book Author')));
}
add_filter('manage_book_posts_columns' , 'add_book_columns');
Here's another example that completely replaces the columns, rather than adding and removing specific ones.
function set_book_columns($columns) {
return array(
'cb' => '<input type="checkbox" />',
'title' => __('Title'),
'date' => __('Date'),
'publisher' => __('Publisher'),
'book_author' =>__( 'Book Author')
);
}
add_filter('manage_book_posts_columns' , 'set_book_columns');
Note the header for the 'cb' column is a checkbox, so that the checked posts can be toggled between all and none.
Since: 3.1
manage_${post_type}_posts_columns is applied by WP_Posts_List_Table->get_columns in wp-admin/includes/class-wp-posts-list-table.php.