2017-03-16 143 views
0

我正在使用WP API创建一个Android应用程序。我设法在REST API中显示一个自定义帖子类型,可以在以下位置查看:在WordPress中的REST API v2中按类别过滤自定义帖子类型

http://localhost/wordpress/wp-json/wp/v2/property 

现在我想按其分类过滤属性, villahomerent等我曾尝试以下,但它不工作:

http://localhost/wordpress/wp-json/wp/v2/property?filter[category_name]=villa` 
http://localhost/wordpress/wp-json/wp/v2/property?filter[category]=apartment` 

回答

1

我与我的自定义文章类型运行到这个问题为好。

您需要通过您的自定义分类法(例如property_categories或任何您在register_taxonomy()函数中命名它)和然后来查询该术语。

&filter[taxonomy]=property_categories&filter[term]=villa 
+0

谢谢:)救了我一天 –

相关问题