Im trying to query custom post type by category_name which is a custom field. So im trying to insert the value of that custom field in to array via varriable but the variable inside the query is for some reason empty. My code looks like this:
<?php $currentCat = the_field('slider_cat'); ?> <?php $loop = new WP_Query( array( 'orderby' => 'desc', 'taxonomy'=>'category', 'term' => $currentCat, 'post_type' => 'news', 'posts_per_page' => 50 ) ); ?> <?php while ( $loop->have_posts() ) : $loop->the_post(); ?> <div class="post"> </div> <?php endwhile; ?>
Any help is appriciated!