When i go to wp-admin/users.php, in the second column i can see the users full name, however, its not in the right order. In Hungary, we use a different name order: http://en.wikipedia.org/wiki/Hungarian_names
So i need to change the name from “First name – Last name” to “Last name – First name”
How can i do this?
You can’t alter the default Name column, but what you can do is hide it and create your own custom column.
First, we add the action and filter on
admin_init
that will add and manage our new column:Next, the function hooked to our filter above which removes the default name column and adds our own custom column:
Last, the function hooked to the action in the first step which outputs the value of the column for each user:
The one thing missing here is that the column is not sortable. I haven’t quite figured out how to do this, though I know the possible method is via the
pre_user_query
action. It seems the SQL has to be modified directly, as the normal means of making a column sortable won’t work in this instance. first/last name are user meta, and you can’t order by user meta within this context of a user query.It also seems that the default Name column is also not sortable anyway, clicking the Name header just does the same thing as clicking the username header- sorts by username, so I suppose you’re not really losing any functionality here!