Count number of post in Taxonomy?

wp_count_terms() counts the number of terms in a taxonomy but not the number of post that have those terms and I've

wp_count_terms() counts the number of terms in a taxonomy but not the number of post that have those terms and I've found that wp_count_post() does not accept a taxonomy.

So whats a guy gotta do to count the number of post in a taxonomy term?

Example:

Term: Apples Post: 89 (this is what I want to get, the number of post with the 'Apples' taxonomy)

Thanks!

wp_count_terms() counts the number of terms in a taxonomy but not the number of post that have those terms and I've found that wp_count_post() does not accept a taxonomy.

So whats a guy gotta do to count the number of post in a taxonomy term?

Example:

Term: Apples Post: 89 (this is what I want to get, the number of post with the 'Apples' taxonomy)

Thanks!

Share Improve this question asked Dec 16, 2013 at 20:33 Jon FurryJon Furry 1872 gold badges3 silver badges13 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 9

The function you are looking for is get_term() http://codex.wordpress/Function_Reference/get_term

and the code would look something like this:

$term = get_term( 1, 'category' );//for example uncategorized category
echo 'count: '. $term->count;

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745167893a4614745.html

相关推荐

  • Count number of post in Taxonomy?

    wp_count_terms() counts the number of terms in a taxonomy but not the number of post that have those terms and I've

    7小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信