WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Filter Reference/manage posts columns

Description

manage_posts_columns is a filter applied to the columns shown on the manage posts screen. It's applied to posts of all types except pages. To add a custom column for pages, hook the manage_pages_columns filter. To add a custom column for specific custom post types, hook the manage_$post_type_posts_columns filter.

Parameters

$columns
(array) (required) An array of column name ⇒ label. The name is passed to functions to identify the column. The label is shown as the column header.
Default: None

Built-in Column Types

Note: Listed in order of appearance. By default, all columns supported by the post type are shown.

cb 
Checkbox for bulk actions.
title 

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.

author 
Post author.
categories 
Categories the post belongs to.
tags 
Tags for the post.
comments 
Number of pending comments.
date 
The date and publish status of the post.


Examples

Add Columns

To add a column showing whether a post is sticky or not:

function add_sticky_column($columns) {
    return array_merge( $columns, 
              array('sticky' => __('Sticky')) );
}
add_filter('manage_posts_columns' , 'add_sticky_column');

To actually display whether or not a post is sticky, hook the manage_posts_custom_column action.

Change Log

Since: 3.1

Source File

manage_${post_type}_posts_columns is applied by WP_Posts_List_Table->get_columns in wp-admin/includes/class-wp-posts-list-table.php.

Related

Actions

Filters