category_description( int $category ): string
Retrieves category description.
Parameters
-
$category
int Optional -
Category ID. Defaults to the current category ID.
Return
string Category description, if available.
More Information
If used in the archive.php template, place this function within the is_category() conditional statement.
Otherwise, this function will stop the processing of the page for monthly and other archive pages.
Source
File: wp-includes/category-template.php
.
View all references
function category_description( $category = 0 ) {
return term_description( $category );
}
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.
Default Usage
Displays the description of a category, given its id, by echoing the return value of the tag. If no category given and used on a category page, it returns the description of the current category.
Result:
WordPress is a favorite blogging tool of mine and I share tips and tricks for using WordPress here.
Note: if there is no category description, the function returns a br tag.
Using Category Slug
Displays the description of a category, using a category slug.
With Category Title
Result:
[html]
<strong>Currently browsing WordPress</strong>: WordPress is a favorite blogging tool of mine and I share tips and tricks for using WordPress here.
[/html]