category_description
最后更新于:2021-11-25 22:38:02
apply_filters( ‘category_description’, string $description, GC_Term $category )
Filters the category description for display.
参数
- $description
-
(string)
Category description. - $category
-
(GC_Term)
Category object.
源文件
文件: gc-includes/class-walker-category.php
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; }