Skip to content

Instantly share code, notes, and snippets.

@oropesa
Last active August 29, 2015 14:16
Show Gist options
  • Save oropesa/b0b8015ebf658242ea12 to your computer and use it in GitHub Desktop.
Save oropesa/b0b8015ebf658242ea12 to your computer and use it in GitHub Desktop.
Add in Users Table from Wordpress Dashboard a new sortable column with user_registered datum (Register Date).
<?php
function alisios_add_user_column_registered( $columns ) {
$columns[ 'user_registered' ] = 'Register Date';
return $columns;
}
add_filter( 'manage_users_columns', 'alisios_add_user_column_registered' );
function alisios_add_user_sortable_column_registered( $columns ) {
$columns[ 'user_registered' ] = 'user_registered';
return $columns;
}
add_filter( 'manage_users_sortable_columns', 'alisios_add_user_sortable_column_registered' );
function alisios_show_user_column_registered($value, $column_name, $user_id) {
$user_data = get_userdata( $user_id );
if ( 'user_registered' == $column_name )
return $user_data->user_registered;
return $value;
}
add_action('manage_users_custom_column', 'alisios_show_user_column_registered', 10, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment