当你在做tax_query
或meta_query
在a中WP_Query
, 你always 必须使用nested
array( array() );
请参见下面的示例进行解释,并注意
relation
论点
$packages = new WP_Query( array(
\'post_type\' => \'vamos-cpt-packages\',
\'tax_query\' => array(
\'relation\' => \'AND\',
array(
\'taxonomy\' => \'vamos-holiday-types\',
\'field\' => \'slug\',
\'terms\' => array( \'activity-holidays\' )
),
array(
\'taxonomy\' => \'vamos-holiday-types\',
\'field\' => \'id\',
\'terms\' => array( 103, 115, 206 ),
\'operator\' => \'NOT IN\'
)
)
) );