apply_filters( 'category_description', string $description, WP_Term $category )

Filters the category description for display.

Parameters Parameters


(string) Category description.


(WP_Term) Category object.

Top ↑

Source Source

File: wp-includes/class-walker-category.php

View on Trac

Top ↑

Changelog Changelog

Version Description
1.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by hasanrang05

    Get access to term data and term field data

    add_action('category_description', 'category_description_28072021', 90, 2);
    function category_description_28072021($description, $term){
        if(is_admin()) return $description;
        //Get term data
        $term_id = isset($term->term_id) ? $term->term_id : $term;
        $category = get_term($term_id);
        $taxonomy = isset($category->taxonomy) ? $category->taxonomy : '';
        // term field data
        $post_count = get_term_field('count', $term_id);
        return  sprintf(__('Total post Count: %s. ', 'textdomain'), $post_count). $description;

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