Tax_query code not working. Help needed
-
Hi,
Im trying to show posts that are in a category and with a tag. I believe this is now possible since 3.1 using tax_query. I have the following code to show all posts in the category of ‘blog’ and with a tag of ‘evening’ but it doesn’t return any results. Any help in fixing it would be much appreciated.
$args = array( 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'category', 'terms' => array('blog'), 'field' => 'slug', ), array( 'taxonomy' => 'post_tag', 'terms' => array('evening'), 'field' => 'slug', ), ), ); $query = new WP_Query( $args );
[Please post code snippets between backticks or use the code button.]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Tax_query code not working. Help needed’ is closed to new replies.