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();
echo '<div class="entry-content">';
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?
- You must be logged in to reply to this topic.