我正在尝试使用“getEntityRecords”从特定的分类术语中获取自定义帖子类型。对于“post”,我可以在“query”对象中使用“categories”属性,如下所示:
getEntityRecords( 'postType', 'post', {per_page: 3, categories: [1,2,3] } )
Run Code Online (Sandbox Code Playgroud)
而且效果很好。但如何对分类术语做同样的事情呢?
我尝试在查询对象中使用“terms”属性,但这不起作用。
getEntityRecords( 'postType', 'my_post_type', {per_page: 3, terms: [1,2,3] } )
Run Code Online (Sandbox Code Playgroud)
我只想获取特定术语的帖子,但现在我获取所有自定义帖子。