Support

Account

Home Forums General Issues Show number of posts with specific value within a category Reply To: Show number of posts with specific value within a category

  • You can use get_terms, then term->count..

    The below will list all the terms from the Desserts taxonomy with their name and post count.

    <?php   
    $terms = get_terms( 'desserts' );
    if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
        echo '<ul>';
        foreach ( $terms as $term ) {
            echo '<li>' . $term->name . ' - ' . $term->count . '</li>';
        }
        echo '</ul>';
    }
    ?>
    

    For more info check – HERE