Problem with sorting entries in a plugin’s admin interface table

Figured this out myself after kaiser pointed me towards the appropriate entry on the Codex, specifically the part at http://codex.wordpress.org/Class_Reference/WP_List_Table#Notice:_Sortable_Columns which I’d managed to miss. Problem was with the get_sortable_columns method, which should look like this:

    public function get_sortable_columns() {
    return $sortable = array(
        'title'=>array('title',true),
        'description'=>array('description',true),
        'submissionDate'=>array('submissionDate',true),
        'name'=>array('name',true),
        'email'=>array('email',true),
        'post_title'=>array('post_title',true)
    );
}

Guess the tutorial I was using must have been incorrect.

Leave a Comment