phpwordpresstaxonomycustom-taxonomy

Show Custom Taxonomy Post Count by the Taxonomy ID


I'm looking for a way to show the amount of posts in each Custom Taxonomy by the ID, I would like to show the amount of posts in my sidebar navigation which is not party of any query so I have each of my custom taxonomy IDs but am not sure how to get the post count from them. I see wordpress has the function

 <?php wp_count_terms( $taxonomy, $args ); ?>

Although I need the post count for each of the post count for each individual category from my custom taxonomy not from my entire custom taxonomy.


Solution

  • I found the solution incase anyone is looking for it

        <?php 
    $args = array(
    'post_type' => 'guides',
    'post_status' => 'published',
    'taxonomy-name' => 'category slug of taxonomy',
    'numberposts' => -1,
        );
        echo $num = count( get_posts( $args ) );
    
    ?>