apply_filters( ‘category_description’, string $description, WP_Term $category )

Filters the category description for display.

Parameters

$descriptionstring
Category description.
$categoryWP_Term
Category object.

Source

$atts['title'] = strip_tags( apply_filters( 'category_description', $category->description, $category ) );

Changelog

VersionDescription
1.2.0Introduced.

User Contributed Notes

  1. Skip to note 2 content

    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.