WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I add a column to users page, it goes wrong when checkbox is not in correct position. This is my code, can you help me to move checkbox to the correct position?

public static function user_register_columns( $columns ) {
    // create a new array with account just after username, then everything else
    $new_columns = array();
    if ( isset($columns['username']) ) {
        $new_columns['username'] = $columns['username'];
    $new_columns['account'] = self::__( 'Account' );
    $new_columns = array_merge($new_columns, $columns);
    return $new_columns;
public static function user_column_display( $empty='', $column_name, $id ) {
    $account = WP_ABC_Account::get_instance( $id );

    if ( !$account )
        return; // return for that temp post

    switch ( $column_name ) {
    case 'account':
        $account_id = $account->get_ID();
        $user_id = $account->get_user_id_for_account( $account_id );
        $user = get_userdata( $user_id );
        $get_name = $account->get_name();
        $name = ( strlen( $get_name ) <= 1  ) ? '' : $get_name;

        //Build row actions
        $actions = array(
            'edit'    => sprintf( '<a href="#">'.self::__( 'Manage' ).'</a>', $account_id ),
            'payments'    => sprintf( '<a href="#">'.self::__( 'Payments' ).'</a>', $account_id ),
            'gifts'    => sprintf( '<a href="#">'.self::__( 'Gifts').'</a>', $account_id )

        //Return the title contents
        return sprintf( self::__( '%1$s <span style="color:silver">(account&nbsp;id:%2$s)</span> <span style="color:silver">(user&nbsp;id:%3$s)</span>%4$s' ),
            WP_List_Table::row_actions( $actions )

        // code...

Result look like this, checkbox is not in correct position. It must always on left.

enter image description here

Thank you

share|improve this question
up vote 1 down vote accepted

I assume you have hooked into manage_users_columns. Probably your array_merge is causing the problem. Instead of using $new_columns as the 1st parameter, use it as the 2nd as given below.

$new_columns = array_merge ( $columns, $new_columns );
share|improve this answer
Thanks for help, but result looks not good too. There is space next to checkbox. Screenshot: i.stack.imgur.com/TLSRv.png – T Kien Dec 3 '13 at 4:03
The space is for name column. Since you do not have any data, it's an empty column. – Chittaranjan Dec 3 '13 at 4:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.