0

i installed PODS and create a new custom post type named locations

and relate it to default Wordpress entity : category

when i call mydomain.com/wp-json/wp/v2/locations?fields=id,category

rest return me :

[{"id":20,"category":[{"icon":{"ID":"8","post_author":"1","post_date":"2018-12-05 11:48:59","post_date_gmt":"2018-12-05 08:18:59","post_content":"","post_title":"users","post_excerpt":"","post_status":"inherit","comment_status":"open","ping_status":"closed","post_password":"","post_name":"users","to_ping":"","pinged":"","post_modified":"2018-12-05 12:33:30","post_modified_gmt":"2018-12-05 09:03:30","post_content_filtered":"","post_parent":"17","guid":"http:\/\/ennings.com\/wp-content\/uploads\/2018\/12\/users.png","menu_order":"0","post_type":"attachment","post_mime_type":"image\/png","comment_count":"0","pod_item_id":"8"},"term_id":3,"name":"a","slug":"a","description":"","taxonomy":"category","parent":[],"term_taxonomy_id":3,"term_group":0,"count":0,"id":3}]},{"id":17,"category":[{"icon":{"ID":"9","post_author":"1","post_date":"2018-12-05 11:49:25","post_date_gmt":"2018-12-05 08:19:25","post_content":"","post_title":"bubbles3","post_excerpt":"","post_status":"inherit","comment_status":"open","ping_status":"closed","post_password":"","post_name":"bubbles3","to_ping":"","pinged":"","post_modified":"2018-12-05 11:49:50","post_modified_gmt":"2018-12-05 08:19:50","post_content_filtered":"","post_parent":"0","guid":"http:\/\/ennings.com\/wp-content\/uploads\/2018\/12\/bubbles3.png","menu_order":"0","post_type":"attachment","post_mime_type":"image\/png","comment_count":"0","pod_item_id":"9"},"term_id":4,"name":"b","slug":"b","description":"","taxonomy":"category","parent":[],"term_taxonomy_id":4,"term_group":0,"count":0,"id":4}]}]

i want to filter by category. and cant.

filter by category.id or category.name or slug

i can filter by other fields there but this field created as relation...

i googled and try to find solution based on google results and articles ... but nothing worked for me

i also installed wp filter and wp field plugin... but cant filter by category

this is not worked:

example.com/wp-json/wp/v2/locations?categories=20,30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.