How to display user – display name,avatar and logout button in WordPress : Example

July 8, 2018

To display user displayname , avatar and provide a logout button for a user in your wordpress site,we can use the following  five worpress functions.

is_user_logged_in () –  Check whether used in.

wp_get_current_user(id/email,null)  –  Get current logged in user

get_avatar_url(userid) – Get avatar url for current user using userid

wp_logout_url(url) – Logout and redirect URL

home_url() – Get your home URL

 

 

Check below links to see documentation in full

https://developer.wordpress.org/reference/functions/is_user_logged_in/

https://developer.wordpress.org/reference/functions/wp_get_current_user/

https://developer.wordpress.org/reference/functions/get_user_by/

https://developer.wordpress.org/reference/functions/wp_logout_url/

 

 

 

 

4 Comments

  • agen judi live casino terpercaya 2018 July 8, 2018 at 4:09 pm

    Great info. Lucky me I discovered your blog by chance (stumbleupon).
    I’ve bookmarked it for later!

  • Userbola.Com September 4, 2019 at 5:20 pm

    Hi! This is kind of off topic but I need some guidance from an established blog.
    Is it difficult to set up your own blog? I’m not very techincal but I
    can figure things out pretty quick. I’m thinking about creating
    my own but I’m not sure where to begin. Do you have any ideas or suggestions?
    With thanks

  • chat alternatif mabosbet September 5, 2019 at 12:29 am

    I’ll immediately grasp your rss feed as I can not
    find your e-mail subscription hyperlink or newsletter service.
    Do you have any? Please permit me recognize so
    that I may subscribe. Thanks.

  • texas holdem September 6, 2019 at 10:46 pm

    It’s remarkable to pay a quick visit this web
    site and reading the views of all mates concerning this piece of writing,
    while I am also keen of getting know-how.

Leave a Reply

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