I have custom post type 'book' and I also make taxonomy name best-book which. I want to filter taxonomy term but it doesn't work. I try to put echo and print_r to find where is my problem and I found that my $loop var return empty array. I also use this style in other pages and never have problem but I can't find why this happen? and how can I have fix it. here is the photo which show it return empty array here is my code
<?php $args = array( 'post_type'=>'book'); loop = new WP_Query( $args ); print_r($loop); while ( have_posts() ) : the_post(); $post=the_post(); $term_list = wp_get_post_terms($post_id, 'best-book', array("fields" => "all")); foreach($term_list as $term_single) } ?>
any idea would be appreciated.