4

Is there a way to display, via a PHP function, the author posts link (myblog.com/author/jason) of the current logged in user ?

In fact, I would like to display, for every logged in user, a "My personnal page" link which links toward his author page.

Thanks !

2 Answers 2

9
<?php 
global $current_user;
get_currentuserinfo();
echo get_author_posts_url($current_user->ID); 
?>
4

Try this :

<a href="<?php echo home_url() . '/author/' . get_the_author_meta( 'user_login', wp_get_current_user()->ID ); ?>" >My personal page</a>
1
  • Be sure to mark as the accepted answer. Also: bloginfo() does not need to be echoed; it prints its output; also, I would recommend using echo home_url(); rather than bloginfo(). Commented Jul 7, 2011 at 14:46