How to Sort Custom columns in admin

I have set a custom column for date in admin, but the sorting is not working, when I click to sort the dates are jumbled up and not sorted correctly. This is the sorting function Im using

function sortable_columns() {
    return array(
        // meta column id => sortby value used in query
        'publishdate' => 'date', // e.g. 1344964575            
    );
} add_filter( "manage_edit-post_sortable_columns", "sortable_columns" );

1 Answer
1

This tutorial from WPTuts+ will do the trick … Quick Tip: Make Your Custom Column Sortable

In a recent article by Claudio Simeone, he demonstrated how you could add extra columns to your post, or custom post type, admin screens (or remove existing ones). In this quick tip I build on that by showing you how to make your newly created columns sortable.

Leave a Comment