我有一个定制的post类型产品(葡萄酒)。以下各项都是自定义分类法:
在葡萄酒的单一产品视图中,我想进行以下查询:
1) 查找所有具有same family, same size 但是来自different vintage
2) 查找same family 并拥有same vintage 还有一个different size.
现在的问题是numeric year 是的自定义术语元属性vintage term. 这个numeric bottle size 是大小术语的自定义术语元属性。
对于第一个查询,我尝试了以下操作:
$other_years = get_posts(array(
\'post_type\' => \'product\',
\'numberposts\' => -1,
\'tax_query\' => array(
array(
\'taxonomy\' => \'family\',
\'field\' => \'id\',
\'terms\' => $family->term_id, // Where term_id of Term 1 is "1".
\'include_children\' => false
),
array(
\'taxonomy\' => \'size\',
\'field\' => \'id\',
\'terms\' => $size->term_id, // Where term_id of Term 1 is "1".
\'include_children\' => false
),
array(
\'taxonomy\' => \'vintage\',
\'field\' => \'id\',
\'terms\' => array($vintage->term_id), // Where term_id of Term 1 is "1".
\'include_children\' => false,
\'operator\' => \'NOT IN\'
),
)
));
It works. 然而:与其比较term_id (此处:年份的术语id)我想比较术语自定义元值(year\\u numeric)是否不同。有没有可能进行这样的查询?