• Resolved Driftless

    (@driftless1)


    I am trying to add custom column(s) to the users admin page using the manage_users_custom_column() hook.

    Consider this:

    add_filter('manage_users_columns', 'add_status_column');
    add_action('manage_users_custom_column', 'manage_status_column', 10, 3);
    
    function add_status_column($columns) {
           	$columns['live_status'] = 'Status';
     	return $columns;
    
    }
    
    function manage_status_column($empty='', $column_name, $id) {
    	if( $column_name == 'live_status' ) {
    		echo $column_name;
    		echo $id;
    
        	}
    }

    Several strange things here:
    1) Had to add the $empty='' to get any results at all
    2) The output is dumped outside the row – after the closing </tr> in each user row… even though the function is clearly called in /wp-admin/includes/template.php file in the right place — meaning that the echos get dumped at the top of the table…

    Any thoughts? I’ve been banging my head against this for hours.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Driftless

    (@driftless1)

    Note: Same behavior in both a plugin as well as the template functions.php file…

    This is weird.

    Thread Starter Driftless

    (@driftless1)

    I see I’m on my own with this one…

    add_filter('manage_users_columns', 'add_status_column');
    add_filter('manage_users_custom_column', 'manage_status_column', 10, 3);
    
    function add_status_column($columns) {
           	$columns['live_status'] = 'Status';
     	return $columns;
    
    }
    
    function manage_status_column($empty='', $column_name, $id) {
    	if( $column_name == 'live_status' ) {
    		return $column_name.$id;
    
        	}
    }

    Enjoy 🙂

    Thread Starter Driftless

    (@driftless1)

    Really? Are you serious? Well, I’ll be…

    BRILLIANT!

    Thanks erez213 — you don’t know how happy that makes me.

    Thanks you so much! I hadn’t realized it should be returned instead of printed!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘manage_users_custom_column Strange Behavior’ is closed to new replies.