Codex tools: Log in
Contents |
Applied to the list of columns to print on the manage posts screen for a custom post type. Filter function argument/return value is an associative array where the element key is the name of the column, and the value is the header text for that column.
In WP 3.1, manage_edit-${post_type}_columns has been supplanted by manage_${post_type}_posts_columns.
See also the action manage_posts_custom_column, which alters the column information for each post in the edit table.
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 set_edit_book_columns($columns) {
unset($columns['author']);
return array_merge($columns,
array('publisher' => __('Publisher'),
'book_author' =>__( 'Book Author')));
}
add_filter('manage_edit-books_columns' , 'set_edit_book_columns');
Here's another example that completely replaces the columns, rather than adding and removing specific ones.
function set_edit_book_columns($columns) {
return array(
'cb' => '<input type="checkbox" />',
'title' => __('Title'),
'date' => __('Date'),
'publisher' => __('Publisher'),
'book_author' =>__( 'Book Author')
);
}
add_filter('manage_edit-books_columns' , 'set_edit_book_columns');
Note the header for the 'cb' column is a checkbox, so that the checked posts can be toggled between all and none.