get_the_archive_description()WP 4.1.0

Retrieves the description of the post type, category, tag, term, or author archive page.

This function is intended to be used on taxonomy (categories and tags), posts and authors archive pages.

On author archive page, the description is retrieved from his Biographical Info field; on taxonomies archive pages — from description field; on posts types archive pages — with get_the_post_type_description() function.

If you want to display the description, use a wrapper for this function: the_archive_description().

Hooks from the function

Return

String. Archive description.

Usage

get_the_archive_description();

Examples

0

#1 Display the description of the archive page (except date archive pages)

Suppose we need to display the description for categories, tags or taxonomies archive pages:

$description = get_the_archive_description();

if ( $description ) {
	echo "The description: $description";
}

But it's better to use the_archive_description() for such purposes if you need just display the description. In this case we could use a $before parameter to prepend the description with our own text.

Notes

Changelog

Since 4.1.0 Introduced.
Since 4.7.0 Added support for author archives.
Since 4.9.0 Added support for post type archives.

get_the_archive_description() code WP 6.4.3

function get_the_archive_description() {
	if ( is_author() ) {
		$description = get_the_author_meta( 'description' );
	} elseif ( is_post_type_archive() ) {
		$description = get_the_post_type_description();
	} else {
		$description = term_description();
	}

	/**
	 * Filters the archive description.
	 *
	 * @since 4.1.0
	 *
	 * @param string $description Archive description to be displayed.
	 */
	return apply_filters( 'get_the_archive_description', $description );
}