-1

I am using custom post types, and I have a problem getting the author URL to his profile.

I can get the author ID using:

$authers_interviewdoctor = get_post_meta( $post->ID , 'authers_interviewdoctor' , true );

However, I need to get the link to his profile, such as:

www.example.com/author/admin
  • have you seen the_author_meta – Wyck May 1 '14 at 21:13
  • its not get me user url – user3576352 May 1 '14 at 21:20
0

You should use get_author_posts_url() to get the author's link.

0

To get the Author URL, you have to use:

<?php global $authordata; ?>
<a href="<?php echo get_author_posts_url( false, $authordata->ID, $authordata->user_nicename ); ?>" title="<?php printf( __( 'View all posts by %s', 'your-theme' ), $authordata->display_name ); ?>">
     <?php the_author(); ?>
</a>
0
<?php 
    $author = get_queried_object();
    echo get_author_posts_url( false, $author->user_nicename ); 
?>
0

Try this:

$authers_interviewdoctor = get_post_meta( $post->ID , 'authers_interviewdoctor' , true );

$auther_url = get_author_posts_url( $authers_interviewdoctor );

Use $auther_url in link href.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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