WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

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

I'd like to ONLY show the authors website link if it exists, but I can't work out the exact syntax for it.

I have this

        if ( get_the_author_meta('user_url') ) : // If a user has filled out their decscription show a bio on their entries

         echo  the_author_meta('user_url');


But I need to wrap it in a link and give that link a class, like this

<a class="meta-website" href="<?php the_author_meta('user_url') ?>">Author's Website</a>

The problem is when I add another 'echo' before the_author_meta one it just breaks the site.

share|improve this question
up vote 1 down vote accepted

Try passing $user_ID global variable to function as following. it is working for me.

  global $user_ID;
  if ( get_the_author_meta('user_url',$user_ID) ) : // If a user has filled out their decscription show a bio on their entries 
  <a class="meta-website" href="<?php the_author_meta('user_url',$user_ID); ?>">Author's Website</a>    
<?php endif; ?>
share|improve this answer
EDIT - I'm an idiot, it does work, hehe. :) – andy Mar 8 '13 at 10:31

I know this is answered, but for future reference, echo the_author_meta('user_url'); Won't work because the_author_meta() outputs the value, so you're trying to echo echo essentially.

You can echo get_the_author_meta() if you're going to keep it with the <?php ?>

share|improve this answer

Your Answer


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.