The function below can be used to get a user’s first and last name with a space between them, like “Kellen Mace”. If they only have a first name saved, it will return that, and it will return their WP login as a last resort. This is useful if you want to display the users’ names in a list, for example.

1 comment

  1. Sunil Sharma July 12, 2018 at 6:26 am

    Reply

    Its very helpful thanks for this code I have been looking for this from 2 weeks . Now I got this its really very helpful for me

Leave a reply

Your email address will not be published. Required fields are marked *