wp_query filter topics by tag
-
I am working on a wordpress template page.
i am trying to retrieve a list of topic threads and filtering by tag.
I can get topics without tag filtering by using something like this
$forumargs = array( 'post_type' => 'topic', 'numberposts' => 15 );
$mytopics = new WP_Query( $forumargs );
while ( $mytopics->have_posts() ) : $mytopics->the_post();
the_title();
echo '<div class="entry-content">';
the_content();
echo '</div>';
endwhile;but when i try to filter by tag , it returns nothing.
$forumargs = array( 'tag'=>'mytagname', 'post_type' => 'topic', 'numberposts' => 15 );
i have seen that there is something called tax_query, but i cannot figure out if i can use that, or how to use it.
how should this work?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.