Help with WP Query args
-
Hi,
Hoping someone can help me with this loop. It works if a term is set. And if I manually change the $arg ‘tax_query’ => ” it works. But it shows no results as it is – I just don’t get it!function news_archive_loop() { global $post; $term = get_query_var(term); if (isset($term)) { $tax_query[] = array( 'taxonomy' => 'news-states', 'field' => 'name', 'terms' => $term ); } else { $tax_query = ''; } $args = array( 'post_type' => 'news-article', 'posts_per_page' => 12, 'post_status' => 'publish', 'paged' => get_query_var( 'paged' ), 'tax_query' => $tax_query );
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Help with WP Query args’ is closed to new replies.