apply_filters( "manage_{$this->screen->id}_sortable_columns", array $sortable_columns )
Filters the list table sortable columns for a specific screen.
Description
The dynamic portion of the hook name, $this->screen->id
, refers to the ID of the current screen.
Parameters
-
$sortable_columns
array -
An array of sortable columns.
Source
File: wp-admin/includes/class-wp-list-table.php
.
View all references
$_sortable = apply_filters( "manage_{$this->screen->id}_sortable_columns", $sortable_columns );
Changelog
Version | Description |
---|---|
3.1.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
As an example. When you see the table with the posts in the admin screen, you can sort the posts by title. If you wanted to remove the ability to sort by the title you could do the following:
The screen ID for the posts overview page in the admin is
edit-post
, so the filter would be “manage_edit-post_sortable_columns”.For the list of custom type, the hook name is a COMBINATION of edit and the custom post type, so let’s say you have custom post type
flowers
and you want to add sorting by e.g.menu_order
you’ve added before, the hook would be called “manage_edit-flowers_sortable_columns’ – the hook code could look something like:If you are interested how would you add the
menu_order
support to a post type in the first place:Looking to sort the columns for the “sites” page in a multisite network? The following does not work as expected:
Instead, try: