WP API – Can I use the newly registered rest field as a query parameter?


I’ve registered some newfield to wordpress pages with the register_rest_field function. THe field shows up fine when I request pages.

However, if I run a query like htts://website.com/wp-json/wp/v2/pages?newfield=xyz, this does not work out of the box.

Is there any way for me to get wordpress API to accept this new field key/value pair as a query string parameter to filter the response for me? I’ve read almost all wp-api documentation but cannot find anything on this.

geochanto 3 months 0 Answers 11 views 0

Leave an answer