【发布时间】:2020-10-18 22:33:19
【问题描述】:
我有多种自定义帖子类型。食谱和配料。食谱页面包含选择成分的 ACF 关系字段。成分自定义帖子属于特定类别“蔬菜”、“肉类”......在成分存档页面上,我想列出包含当前类别成分的食谱。任何帮助或指示将不胜感激。
$args = array(
'post_type' => 'recipes',
'meta_query' => array(
array(
'key' => 'ingredient_name', // custom field name
'value' => '"' . get_terms('ingredients_categories') . '"', // assuming that this is getting post's categories
'compare' => 'LIKE'
)
)
);
【问题讨论】:
标签: php wordpress relationship advanced-custom-fields