The get_the_author_description() WordPress PHP function retrieves the description of the author of the current post.
Usage
To use get_the_author_description() in your theme, simply add the function within the loop:
echo get_the_author_description();
Parameters
This function has no parameters.
More information
See WordPress Developer Resources: get_the_author_description()
This function was introduced in WordPress version 2.8.0.
Examples
Display author description in a single post template
In this example, we will display the author’s description below the post content in a single post template.
// In single.php or a similar post template file if ( have_posts() ) { while ( have_posts() ) { the_post(); // ... the_content(); // Display author description echo '<div class="author-description">' . get_the_author_description() . '</div>'; // ... } }
Display author description in an author archive template
In this example, we will display the author’s description at the top of an author archive template.
// In author.php or a similar author archive template file $author_description = get_the_author_description(); if ( ! empty( $author_description ) ) { echo '<div class="author-description">' . $author_description . '</div>'; }
Display author description with a custom label
In this example, we will display the author’s description with a custom label.
$author_description = get_the_author_description(); if ( ! empty( $author_description ) ) { echo '<h3>About the Author</h3>'; echo '<div class="author-description">' . $author_description . '</div>'; }
Display author description in a custom function
In this example, we create a custom function to display the author’s description and call the function within the loop.
function my_custom_author_description() { $author_description = get_the_author_description(); if ( ! empty( $author_description ) ) { echo '<div class="author-description">' . $author_description . '</div>'; } } // In a template file within the loop my_custom_author_description();
Conditional display of author description
In this example, we will display the author’s description only if the author has a description set in their profile.
// In a template file within the loop $author_description = get_the_author_description(); if ( ! empty( $author_description ) ) { echo '<div class="author-description">' . $author_description . '</div>'; } else { echo '<div class="no-author-description">This author has not provided a description.</div>'; }