我有一个名为的自定义帖子类型和一个名为(充当类别)portfolio的自定义分类法build-type
我正在尝试portfolio按 ID 查询帖子,build-type例如“酒店”中的所有投资组合帖子(该分类的 id=4)
// gets the ID from a custom field to show posts on a specific page
$buildType = get_post_meta($post->ID, 'build_type_id', true);
// run query
query_posts(array(
'post_type' => 'portfolio',
'showposts' => -1,
'tax_query' => array(
'taxonomy' => 'build-type',
'terms' => $buildType,
'field' => 'term_id'
),
'orderby' => 'title',
'order' => 'ASC'
));
目前它正在调用所有 portfolio帖子,而不仅仅是那些有build-typeID的帖子
因为'field' => 'term_id'我应该使用term_id,tag_ID还是id其他东西?
任何人都知道如何让这个工作?
提前致谢!