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

Is it possible to only display the author's name and description (aka bio) if the description contains text?

This code doesn't work (it doesn't return the name or description) but hopefully it can be edited to accomplish this goal:

$authorDesc = the_author_meta($post->ID, 'description', true);
if (!empty($authorDesc)) {
<em>by <?php the_author(); ?></em>
<span><?php the_author_meta('description'); ?></span>
<?php } ?>
share|improve this question
up vote 2 down vote accepted
$authordesc = get_the_author_meta( 'description' );

if ( ! empty ( $authordesc ) )
    <a href="<?php
    echo get_author_posts_url( get_the_author_meta( 'id' ) );
    echo wpautop( $authordesc );
share|improve this answer

First, you need to use get_the_author_meta instead of the_autho_meta to give a vakue to $authorDesc (get_the_author_meta returns the value, the_author_meta displays it).

Secondly, you need to use user_description as the argument for both functions instead of description.

Hope it works.

EDIT - Here is the documentation to the_author_meta for more info. EDIT 2 - You also don't need to declare $post->ID as the first parameter for the_author_meta. Are you using it inside the loop?

share|improve this answer
Yes, I'm using this inside the loop. I tried your edits but can't seem to get it working: <?php $authorDesc = get_the_author_meta('','user_description', true); if (!empty($authorDesc)) { ?> <em>by <?php the_author(); ?></em> <span><?php get_the_author_meta('user_description'); ?></span> <?php } ?> – Ryan Mar 5 '11 at 0:18
@Ryan - Forgot to mention, try to use get_the_author_meta=("user_description"),without true. And, in the second run,in the span, you need to either echo get_the_user_meta or use the_author_meta (no get). – Cronco Mar 5 '11 at 0:42

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.