admin管理员组

文章数量:1122832

I'm quit new for wordpress development. Working with property management website with mobile API Development.

Here need to filter the data's for based on conditions like greater than and less than & between range.

For example need to filter and search the data's where price filter range and between and greater or less than bedrooms. Kindly help me to solve this issue.I've tried below example but not works to me

http://192.168.0.88:8825/wp-json/wp/v2/properties?filter[meta_key]=property_bathrooms&filter[meta_value]=4&filter[meta_compare]=>=&filter[meta_key]=property_bedrooms&filter[meta_value]=5&filter[meta_compare]=>=&filter[meta_key]=property_price&filter[meta_value]=5,500&filter[meta_compare]=between

I'm quit new for wordpress development. Working with property management website with mobile API Development.

Here need to filter the data's for based on conditions like greater than and less than & between range.

For example need to filter and search the data's where price filter range and between and greater or less than bedrooms. Kindly help me to solve this issue.I've tried below example but not works to me

http://192.168.0.88:8825/wp-json/wp/v2/properties?filter[meta_key]=property_bathrooms&filter[meta_value]=4&filter[meta_compare]=>=&filter[meta_key]=property_bedrooms&filter[meta_value]=5&filter[meta_compare]=>=&filter[meta_key]=property_price&filter[meta_value]=5,500&filter[meta_compare]=between
Share Improve this question asked May 7, 2016 at 11:14 sankar muniyappasankar muniyappa 532 silver badges9 bronze badges 0
Add a comment  | 

1 Answer 1

Reset to default 0

Using meta_key and meta_value are good for filtering a single custom field. But for comparing two fields, you need to construct a meta_query with your two key/values and a compare operator.

See this answer which shows the various things you need to do to achieve this.

https://wordpress.stackexchange.com/a/227869/111022

本文标签: