Support

Account

Home Forums Front-end Issues Getting the post count from a multiple taxonomy based on a specific post type

Unread

Getting the post count from a multiple taxonomy based on a specific post type

  • I have an ACF multiple taxonomy field to specify featured categories. I am looping over this field to get those categories and display them with a post count like this:

    <?php
    foreach ($featured_categories as $category) :
    ?>

  • <?= $category->name; ?> (<?= $category->count; ?>)
  • <?php
    endforeach;
    ?>

    The issue I’m running into is that this is a shared taxonomy between two post types, so it is displaying the total post count across both of those post types. Is it possible to display the count based on a specific post type?

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.