我有一个名为自定义的帖子类型portfolio和一个名为build-type(作为类别)的自定义分类
我正在尝试portfolio通过build-typeID 查询帖子,例如"酒店"中的所有投资组合帖子(对于该分类,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'
));
Run Code Online (Sandbox Code Playgroud)
目前它正在调用所有 portfolio帖子,而不仅仅是那些有build-typeID的帖子
对于'field' => 'term_id'我应该使用term_id,tag_ID,id或其他什么东西? …