How to use Sortable Columns

Why use sorting

The sorting feature of Admin Columns helps you to sort content on any WordPress list table. It puts your content in a meaningful order and you can sort on almost any type of content. Need to know which post uses the most words? Or which images are slowing down your site due to their large size? Sorting helps you find any type of content faster and easier, reducing the time needed to manage your content.

We optimized every sorting query to be as fast as possible and use minimal memory. We tested the most demanding sorting queries on datasets over 40.000 records without problems.


How to enable column sorting

  1. Go to the column settings screen: Dashboard > Settings > Admin Column.
  2. Enable sorting by clicking the sort icon.

  3. You can now sort by the column by clicking the column header in the posts (or other content) list table. Click the header again to switch between sorting ascending and descending.
  4. You can always return to the default sorting by clicking Reset Sorting

Which columns are Sortable

Go to the Columns category to see which columns are sortable.


Set the Default Sorted Column

The WordPress default for sorting is usually the title or the date column. You can change the default sorted column by selecting it from the menu.
When you visit the list table for the first time or when you click Reset Sorting the list table will be sorted by your column of choice.

You can set a different Default Sorted Column per list table.


Show all results when sorting

Read more about the setting Show all results when sorting.


Example Usage

Custom Post Types

In this example, we have a custom post type (Houses) with custom fields. By adding the Custom Field columns you can now sort any content on the list table.