M
M
matros972018-01-27 19:42:13
WordPress
matros97, 2018-01-27 19:42:13

The selection for a certain taxomy does not work?

Hello, I can't figure out what's wrong.

<?php $expert = new WP_Query(array(

 			'post_type' => 'expert',

 			'posts_per_page' => -1,

 			'orderby'       => 'title',

 			'tax_query' => array(

 					'taxonomy' => 'categoryexpert',
 					'field'    => 'id',
 					'terms'    => array(6),
          'operator' => 'IN',

 			), 

 	)); ?>

I have two categories in a taxomy, and I want to select only one by one, but for some reason I have a selection from two taxomies at once, what could be the problem

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2018-01-28
@Alex-Woo

tax_query is an array of arrays

<?php $expert = new WP_Query(array(
 			'post_type' => 'expert',
 			'posts_per_page' => -1,
 			'orderby'       => 'title',
 			'tax_query' => array(
                                array(
 					'taxonomy' => 'categoryexpert',
 					'field'    => 'id',
 					'terms'    => array(6),
                                         'operator' => 'IN',
                               )
 			)
 	)); ?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question