WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My header looks like this.

enter image description here

I chnaged my author base from "author" to "user"

So the user profile url looks like this.


What is the php function to get this url.

I'm using like this

<a href="<?php echo esc_url( home_url( '/' ) ); ?>user/<?php echo $current_user->user_login ?>"><?php echo $current_user->user_login ?></a>

Its working. But its hard coded.

Is there any other php function to get the url?

share|improve this question
up vote 1 down vote accepted

For all author meta details you can use the_author_meta


<a href="<?php the_author_meta('user_url', $current_user->ID);?>"><?php the_author_meta('display_name', $current_user->ID);?></a>

If its for user meta use get_user_meta


<a href="<?php echo get_user_meta($current_user->ID, 'user_url');?>"><?php echo get_user_meta($current_user->ID, 'display_name');?></a>
share|improve this answer

Do you search for get_author_posts_url( $author_id, $author_nicename )?

Note, you need the author ID, not the login name.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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