Skip to:

Show xprofile field in wordpress users list

  • notlicht



    I want to show xprofile field as a seperate column in wordpress users list.
    I mean the user list in wordpress backend….

    Do you have any idea?

Viewing 4 replies - 1 through 4 (of 4 total)

  • notlicht


    I think I solved it, but i am not sure if this is a good solution 😉
    I added this into my function.php of my childtheme:

    add_action( 'manage_users_custom_column', 'din_print_user_columns', 15, 3 );
    add_filter( 'manage_users_columns', 'din_add_user_columns', 15 );
    function din_print_user_columns( $value, $column_name, $id ) 
        if( 'Vertriebsnummer' == $column_name ) 
            $new_column = xprofile_get_field_data( 'Vertriebsnummer', $id );
            return $new_column;
    function din_add_user_columns( $vertrieb ) 
         $vertrieb['Vertriebsnummer'] = 'Vertriebsnummer';
         return $vertrieb;

    Henry Wright


    @notlicht manage_users_custom_column and manage_users_columns are the hooks I would use so your approach looks good to me. There’s also manage_users_sortable_columns if you want to sort users by data in your custom column.




    SLIcore Design


    Hi there, notlicht!
    I know this was a while ago but I was wondering if you got your function to work and have your xprofile data showing in your WP admin user list.

    I have been at this for hours and I just now got it to work… by accident!

    I honestly have this thread to thank because none of the others worked.

    I worked off your code above and did the following to bring in users’ dogs’ names into my admin area.

    add_action( ‘manage_users_custom_column’, ‘dogname_column’, 15, 3 );
    add_filter( ‘manage_users_columns’, ‘modify_user_table’, 15 );

    function dogname_column( $value, $column_name, $id) {
    if ( ‘dogname’ == $column_name)
    $doggycolumn = xprofile_get_field_data( ‘2’, $id );
    return $doggycolumn;

    function modify_user_table( $column ) {
    $column[‘dogname’] = ‘Dog\’s Name’;
    return $column;

    None of this worked until I put the 2 for $field_id in single quotes in the arguments for xprofile_get_field_data, forgot that I put it in quotes, and then refreshed my website’s page. There were all the dog names! I don’t know how that works. I guess ID numbers are closer to strings than integers?

    Anyway, that’s what did it for me. Don’t ask me why this was so important to have dog names in my user list… call it a challenge.

    I hope yours worked!

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Skip to toolbar