Wordpress QP_Query operator -


i trying create query news category a,b,c

i wont article in categories.

array (     [post_type] => catalog     [order] => desc     [orderby] => date     [status] => publish     [paged] => 1     [tax_query] => array         (             [0] => array                 (                     [taxonomy] => catalog_category                     [field] => id                     [include_children] => 1                     [operator] => ,                     [terms] => array                         (                             [0] => 12                             [1] => 17                             [2] => 43                         )                  )          )  ) 

if use "operator" "in" articles if use "and" none results.

list of cats , articles:

enter image description here

as can see, have 1 article in 3 categories.

what mistake?

your query seems fine not sure wrong, anyways, alternative may give try posts (custom post type = catalog) belongs 3 categories in (a, b , c), not less/more exact match of categories.

$cat_ids = array(); // id each category name foreach(array('a', 'b', 'c') $cat) {     $cat_ids[] = get_cat_id($cat) } $args = array(     'post_type' => 'catalog', // <-- post type 'catalog', not 'news', right ?     'category__and' => $cat_ids,     'orderby' => 'date',     'order' => 'desc',     'status' => 'publish' ); $query = new wp_query($args); 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

php - Add the correct number of days for each month -