How can I show the post count in a taxonomy page. I tried some codes but I could not get success. I will locate this information on the top of taxonomy page.

foreach ( get_the_terms( get_the_ID(), 'taxonomy' ) as $term )
  echo  $term->count ;
  • I am using woody snippets plugin to insert php code to custom taxonomy page because i create custom taxonomies with post type builder plugin – Ramin Mahmudov May 31 '19 at 14:32

İ found a solution:

$posts = get_queried_object();
echo $posts->count;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.