我举个例子:
$myquery[\'tax_query\'] = array(
\'relation\' => \'OR\',
array(
\'taxonomy\' => \'cities\',
\'terms\' => \'boston\',
\'field\' => \'slug\',
\'operator\' => \'NOT IN\'
),
array(
\'taxonomy\' => \'cities\',
\'terms\' => \'chicago\',
\'field\' => \'slug\',
\'operator\' => \'NOT IN\'
),
);
query_posts($myquery);
但我想做一个普通的表格,因为我有一个带复选框的表格。每个复选框都是我的分类法“城市”的一个术语。这个想法是,如果用户选中任何复选框,它应该显示所有没有标记的帖子。但我希望为tax\\U查询生成与选中复选框一样多的数组。我的意思是:如果用户检查Boston,我会创建:
array(
\'taxonomy\' => \'cities\',
\'terms\' => \'boston\',
\'field\' => \'slug\',
\'operator\' => \'NOT IN\'
),
如果用户检查芝加哥:
array(
\'taxonomy\' => \'cities\',
\'terms\' => \'chicago\',
\'field\' => \'slug\',
\'operator\' => \'NOT IN\'
),
如果用户同时检查这两个选项:
array(
\'taxonomy\' => \'cities\',
\'terms\' => \'boston\',
\'field\' => \'slug\',
\'operator\' => \'NOT IN\'
),
array(
\'taxonomy\' => \'cities\',
\'terms\' => \'chicago\',
\'field\' => \'slug\',
\'operator\' => \'NOT IN\'
),
我该怎么做?