3

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 !

migrated from stackoverflow.com Jul 7 '11 at 6:21

This question came from our site for professional and enthusiast programmers.

8
<?php 
global $current_user;
get_currentuserinfo();
echo get_author_posts_url($current_user->ID); 
?>
3

Try this :

<a href="<?php echo home_url() . '/author/' . get_the_author_meta( 'user_login', wp_get_current_user()->ID ); ?>" >My personal page</a>
  • 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(). – Chip Bennett Jul 7 '11 at 14:46