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

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 !

share|improve this question

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

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

<?php 
global $current_user;
get_currentuserinfo();
echo get_author_posts_url($current_user->ID); 
?>
share|improve this answer

Try this :

<a href="<?php echo home_url() . '/author/' . get_the_author_meta( 'user_login', wp_get_current_user()->ID ); ?>" >My personal page</a>
share|improve this answer
    
It works !!! Thank you so much ! – Job78 Jul 7 '11 at 13:48
    
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
1  
@Chip Bennett, thanks, I updated the code. – mike23 Jul 7 '11 at 15:13

protected by toscho Jul 31 '14 at 7:36

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?