category_description( int $category )

Retrieve category description.


Description Description


Parameters Parameters

$category

(int) (Optional) Category ID. Will use global category ID by default.


Top ↑

Return Return

(string) Category description, available.


Top ↑

Source Source

File: wp-includes/category-template.php

function category_description( $category = 0 ) {
	return term_description( $category, 'category' );
}

Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note content
    Contributed by Codex

    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.

     <div><?php echo category_description(3); ?></div> 
    

    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.

  2. Skip to note content
    Contributed by Codex

    With Category Title

     <div>
     	<strong><?php single_cat_title( __( 'Currently browsing', 'textdomain' ) ); ?></strong>:
    	<?php echo category_description(); ?>
    </div> 
    

    Result:

    <strong>Currently browsing WordPress</strong>: WordPress is a favorite blogging tool of mine and I share tips and tricks for using WordPress here.
    

You must log in before being able to contribute a note or feedback.