<?php $cat_id = get_field('category_id'); //USING ACF $args = array( 'post_type' => 'product', 'post_status' => 'publish', 'ignore_sticky_posts' => 1, 'posts_per_page' => - 1, 'tax_query' => array( array( 'taxonomy' => 'product_cat', 'field' => 'term_id', //This is optional, as it defaults to 'term_id' 'terms' => $cat_id, 'operator' => 'IN' // Possible values are 'IN', 'NOT IN', 'AND'. ) ) ); $loop = new WP_Query($args); ?> <?php if ($loop->have_posts()): ?> <?php while ($loop->have_posts()): $loop->the_post(); ?> <!-- Item Start --> <div class="single-submission-item product-listing-carousel-item"> <div class="submission-item-action-btn"> <a href="<?php the_permalink(); ?>" class="submission-item-view-details-btn"><?php the_title(); ?></a> </div> </div> <!-- Item End --> <?php endwhile; endif; ?> <?php wp_reset_postdata(); ?>