Quantcast
Channel: Toolset » All Posts
Viewing all articles
Browse latest Browse all 20145

Reply To: [Waiting for user confirmation] How to query a taxonomy with two words, and it's child?

$
0
0

Ah, it turns out I had a couple of things wrong:

1. I'm used to seeing WP_Query terms in "underscore_case" so assumed this is how they'd be stored in the database. I took a look at the wp_term_taxonomy table and it's as it looks on the admin, i.e." hyphen-case". I also had my "tax_query" code a little wrong, as it's an array of an array i.e.

'tax_query' => array(
  array(
    'taxonomy' => 'slider-categories', // the taxonomy group
    'field' => 'slug', // To get the taxonomy category,  this can also be ID
    'terms' => 'homepage-slider', // Your taxonomy category slug
    'operator' => 'AND' // This can be IN, NOT IN, or AND
  )
)

A better explanation of this can be found <a href="http://wordpress.stackexchange.com/questions/50399/only-show-posts-from-a-certain-category">here</a>


Viewing all articles
Browse latest Browse all 20145

Trending Articles