Multiple Categories Loop (Taxonomy) – ACF

I have 50 items that have to be sorted using custom categories (15 of those). I’m using ACF and CPT UI for this. My custom post type name is “cars” and custom taxonomy is “car_category”. Many of the items will have multiple categories. When I started adding those multiple categories to actual items they became completely mixed up. I know I’m missing something but I can’t find my mistake.

Here’s my code from taxonomy-car_category.php:

  <?php 

  $posts = get_posts(array(
  'posts_per_page'  => -1,
  'post_type'           => 'cars'
  ));

  if( $posts ): ?>

    <?php while ( have_posts() ) : the_post(); ?>

      <a href="<?php the_permalink(); ?>">
        <?php echo the_post_thumbnail(''); ?>
      </a>

    <?php endwhile; ?>

  <?php endif; ?>

Read more here: Multiple Categories Loop (Taxonomy) – ACF

Leave a Reply

Your email address will not be published. Required fields are marked *