WordPress Filter: manage edit-post type columns

This filter 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.

Add Columns

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) {


return array_merge($columns,

array('publisher' => __('Publisher'),

'book_author' =>__( 'Book Author')));


add_filter('manage_edit-books_columns' , 'set_edit_book_columns');

Replace 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' => '',

'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.

via Plugin API/Filter Reference/manage edit-post type columns « WordPress Codex.

Tagged ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: