【发布时间】:2020-01-12 16:17:29
【问题描述】:
我正在尝试使用“getEntityRecords”从特定分类术语中获取自定义帖子类型。对于“post”,我可以在“query”对象中使用“categories”属性,如下所示:
getEntityRecords( 'postType', 'post', {per_page: 3, categories: [1,2,3] } )
而且效果很好。但是如何对分类术语做同样的事情呢?
我尝试在查询对象中使用“terms”属性,但这不起作用。
getEntityRecords( 'postType', 'my_post_type', {per_page: 3, terms: [1,2,3] } )
我只想获得特定期限的帖子,但现在我获得了所有自定义帖子。
【问题讨论】:
标签: wordpress-rest-api wordpress-gutenberg gutenberg-blocks