0

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
0

1 Answer 1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.