我有一个自定义后类型,称为portfolio
,并呼吁build-type
一个自定义分类(作为类别)查询职位
我试图通过build-type
ID例如查询portfolio
职位在“酒店”的所有投资组合的帖子(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-type
ID
对于'field' => 'term_id'
我应该使用term_id
, tag_ID
,id
还是别的?
任何人都知道如何才能正常工作?
在此先感谢!
查看上面Mike,已解决 – mattberridge