I need to be able to show some informations only to the author in his profile viewable in the front end, for istance I need to add a text under the avatar that only the author, if logged in, can see. This text will inform them that they can change the avatar anytime by adding it in their profile page... I could also add some more details... Is there a way to achieve this? Thanks!

  • Nothing at all! I've been searching on Google and here too with no luck. I guess everything is related to author_name, if he/she is logged than I show a text or anything else if another author is logged in but has a different name then the text is hided. I've no clue...
    – user27309
    Commented Mar 15, 2013 at 16:14
  • Not the name, but rather the ID. Have posted an answer that should hopefully help you get started.
    – David Gard
    Commented Mar 15, 2013 at 16:22

2 Answers 2


You can check who the current user is and whether they have the same ID as the user that is being viewed.

global $current_user

if(the_author_meta('ID') === $current_user->ID) :
    // Add your code here...

See these Codex pages for more information -


This one works for me...

    global $current_user;<br>
    if (is_user_logged_in() && (current_user_can('edit_others_posts') ||
    $current_user->ID == $post->post_author) ) {my text goes here');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.