Title: make extra columns in user.php sortable
Last modified: August 20, 2016

---

# make extra columns in user.php sortable

 *  [ensonic](https://wordpress.org/support/users/ensonic/)
 * (@ensonic)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/make-extra-columns-in-userphp-sortable/)
 * I am trying to make extra columns added by [http://wordpress.org/extend/plugins/check-last-login/](http://wordpress.org/extend/plugins/check-last-login/)
   
   sortable. Just add the code below to the end of the current plugin code. Something
   happens to the sort-order, but its not sorting the strings.
 *     ```
       add_filter( 'manage_users_sortable_columns', 'cll_users_edit_columns' );
   
       // this does not fully work yet :/
       function custom_column_orderby( $vars ) {
       	if ( isset( $vars['orderby'] )) {
                       if ('Registered' == $vars['orderby'] ) {
       		        $vars = array_merge( $vars, array(
       			        'meta_key' => 'Registered',
       			        'orderby' => 'meta_value_num'
       		        ) );
                       } elseif ('Lastlogin' == $vars['orderby'] ) {
       		        $vars = array_merge( $vars, array(
       			        'meta_key' => 'Lastlogin',
       			        'orderby' => 'meta_value_num'
       		        ) );
                       }
       	}
   
       	return $vars;
       }
       add_filter( 'request', 'custom_column_orderby' );
       ```
   

Viewing 16 replies (of 16 total)

[←](https://wordpress.org/support/topic/make-extra-columns-in-userphp-sortable/?output_format=md)
[1](https://wordpress.org/support/topic/make-extra-columns-in-userphp-sortable/?output_format=md)
2

 *  [bluantinoo](https://wordpress.org/support/users/bluantinoo/)
 * (@bluantinoo)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/make-extra-columns-in-userphp-sortable/page/2/#post-2248479)
 * People, after a quite a lot of searching I must thanks uncle Google for showing
   up this result: [Codepress Admin Columns](http://wordpress.org/extend/plugins/codepress-admin-columns/)
 * it’s just amazing, works perfectly: you can add wichever columns, not only to
   usersbut even to media library, comments, links and wathever post type!
 * the only downside is that to have all the column sortable you need to buy the“
   [sortable addon](http://www.codepress.nl/plugins/codepress-admin-columns/sortorder-addon/)“,
   but actually I think this plugin it’s worth 15 bukcs!
 * and I’m using it in collaboration with [User Meta Pro Plugin](http://user-meta.com).
 * The Pro version of User Meta is still a young product and not much support is
   provided, but in my opinion still worth 16 bucks.
 * so, for a total user management I suggest to use them together.
    Two small prices
   for user management troubles liberation 😉
 * works like a charm!

Viewing 16 replies (of 16 total)

[←](https://wordpress.org/support/topic/make-extra-columns-in-userphp-sortable/?output_format=md)
[1](https://wordpress.org/support/topic/make-extra-columns-in-userphp-sortable/?output_format=md)
2

The topic ‘make extra columns in user.php sortable’ is closed to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 16 replies
 * 10 participants
 * Last reply from: [bluantinoo](https://wordpress.org/support/users/bluantinoo/)
 * Last activity: [13 years, 9 months ago](https://wordpress.org/support/topic/make-extra-columns-in-userphp-sortable/page/2/#post-2248479)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
