Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

http://example.com/user/username

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
add comment

2 Answers 2

up vote 1 down vote accepted

For all author meta details you can use the_author_meta

http://codex.wordpress.org/Template_Tags/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

http://codex.wordpress.org/Function_Reference/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
add comment

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
add comment

Your Answer

 
discard

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.