apply_filters( "manage_{$screen->id}_columns", string[] $columns )
Filters the column headers for a list table on a specific screen.
Description
The dynamic portion of the hook name, $screen->id
, refers to the ID of a specific screen. For example, the screen ID for the Posts list table is edit-post, so the filter for that screen would be manage_edit-post_columns.
Parameters
-
$columns
string[] -
The column header labels keyed by column ID.
Source
File: wp-admin/includes/screen.php
.
View all references
$column_headers[ $screen->id ] = apply_filters( "manage_{$screen->id}_columns", array() );
Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
Example migrated from Codex:
Add Columns
Suppose you have a ‘books’ custom post type and you want to add the publisher and book author to the list of columns.
Replace Columns
Here’s another example that removes and replaces some of the columns.
Note that unlike an
array
data type, theunset
PHP function accepts arguments in which the last argument should NOT end with a comma.Hide Columns
Here is an example of how to remove or (hide) columns from Pages / Posts and Custom Post Types without adding any.
You can also add the name of the custom-post type and filter them out in there too… But if you have 5 custom post types you will need five different filters.
Note: Replace the text CUSTOMPOSTTYPE below with the name of your post type.
Example migrated from Codex:
Add an extra column to the users table: