in my multi author website I have a button that users can upload their avatars. I need to display this button in author page. I can do it. I added this button to author page. The problem is that author can see this button in other author's page too . That's why I need to display this button in author page of current user. I am so sorry I have no any reference code. I have no any idea how to do it. please help. Thank you for you attention. how to code that if current author page belongs to current user

  • 2
    Please add the code you're using to the question.
    – Himad
    Jun 3 at 17:24
  • @himad sorry. I have no idea how to do this thats why sorry . no code Jun 3 at 17:31
  • You mentioned you managed to add the button to all author pages. Can you add that code here?
    – Himad
    Jun 3 at 17:32
  • @Himad I added to code into topic. This is just a shorcode. I use it in header for logged in users Jun 3 at 17:37

1 Answer 1


The is_author() conditional can be used to check if the query is targeting an author's page. By passing one or more User IDs/nicenames into it, it will check for specific author pages. So to check if the current author page is for the current user, it can be passed the return value from get_current_user_id():

if ( is_user_logged_in() && is_author( get_current_user_id() ) ){
  echo "belongs to current user ";
else {
  echo "not belongs to current user";
  • 1
    Excellent! An even simpler way to write this is is_author(get_current_user_id())
    – bosco
    Jun 3 at 18:27
  • @bosco thank you. I would be grateful if you improve my code with your answer. How to apply is_author(get_current_user_id()) Jun 3 at 18:37
  • @bosco thank you very much. really your way is better Jun 3 at 18:57
  • 1
    It's really pretty much performing the exact same check that you were doing manually - just with a little less typing :)
    – bosco
    Jun 3 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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