DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

WordPress offers users the option to add biographical info for each author. This bio can be displayed on your theme using the the_author_meta( ‘description’ ) function. But what if you’d like to display only a bio excerpt? Here’s a function to do it.

The first thing to do is to create the function. To do so, paste the following code into your functions.php file:

	function author_excerpt (){	                     					
		$word_limit = 20; // Limit the number of words
		$more_txt = 'read more about:'; // The read more text
		$txt_end = '...'; // Display text end 
		$authorName = get_the_author();
		$authorUrl = get_author_posts_url( get_the_author_meta('ID'));
		$authorDescription = explode(" ", get_the_author_meta('description'));
		$displayAuthorPageLink = count($authorDescription) > $word_limit ? $txt_end.'<br /> '.$more_txt.' <a href="'.$authorUrl.'">'.$authorName.'</a>' : '' ;
		$authorDescriptionShort = array_slice($authorDescription, 0, ($word_limit));
		return (implode($authorDescriptionShort, ' ')).$displayAuthorPageLink; 		

Once done, simply call the function when needed, as shown below:

<?php  if (function_exists('author_excerpt')){echo author_excerpt();} ?>

Thanks to Tim Marcher for the tip!



  1. Realy? explode(” “, $desc)? What about HTML in that author’s bio?

    Better code:

    return wp_trim_words(strip_tags(get_the_author_meta('description')), 20, $more_txt . ' ‘.$authorName.’‘);



  2. very good.

  3. Thanks, I was looking for that WP code!

  4. Thanks alot, great code, exactly what I was looking for.

Leave a Comment

Your email address will not be published. Required fields are marked *