how to filter the data's comparison operators (>= & <=) & range between values using the WP REST API

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_bathroomsfilter[meta_value]=4filter[meta_compare]==filter[meta_key]=property_bedroomsfilter[meta_value]=5filter[meta_compare]==filter[meta_key]=property_pricefilter[meta_value]=5,500filter[meta_compare]=between

Topic wp-reset-query rest-api custom-taxonomy custom-field Wordpress

Category Web


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

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.