apply_filters( 'manage_posts_columns', string[] $post_columns , string $post_type )
Filters the columns displayed in the Posts list table.
Contents
Parameters
-
$post_columns
string[] -
An associative array of column headings.
-
$post_type
string -
The post type slug.
More Information
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.- Built-in Column Types
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.
Source
File: wp-admin/includes/class-wp-posts-list-table.php
.
View all references
$posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type );
Changelog
Version | Description |
---|---|
1.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
If you only want to modify the table view of your Posts, you can use the hooks:
manage_post_posts_columns
andmanage_post_posts_custom_column
To add a custom column, hook into this filter, and add an item to the
$post_columns
array. The key should be a string ID, and the value should be the human-readable text to display in the column’s header.If the new custom column is only for the default post type, then it needs to check the post type.
Top ↑
Feedback
Note: If you are using “@Keramot UL Islam” solution, make sure to return a default $columns otherwise it will mess up other post type’s columns. I.E.
— By merlinthewarlock —
Example: To add custom featured image thumbnail column in the post.
Example migrated from Codex:
To add a column showing whether a post is sticky or not:
To actually display whether or not a post is sticky, hook the manage_posts_custom_column action.
To add and remove columns from backand posts > all post .
To add and remove columns from backand posts > all post .
Example: This will remove the author, categories, tags and comment columns from backend Posts > All Posts section.