Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I search in WP-API for a custom field #29

Open
kala725 opened this issue Sep 30, 2015 · 2 comments
Open

How can I search in WP-API for a custom field #29

kala725 opened this issue Sep 30, 2015 · 2 comments
Labels

Comments

@kala725
Copy link

kala725 commented Sep 30, 2015

like we are searching for any post title as

wp-json/wp/v2/posts/?filter[name]=

Then how to search for acf

I tried
wp-json/wp/v2/posts/?filter[meta_key]=field_name&filter[meta_value]=filter_value

But no success.... Can you please help???

@chrishutchinson
Copy link
Contributor

Hey @kala725,

This was possible in v1 of WP-API by following my suggestion in issue #13, however I suspect that's changed in v2 of WP-API, which it looks like you're using.

I'll try and find some time in the coming days to take a look at this, and hopefully get an alternative answer for you!

@chrishutchinson
Copy link
Contributor

Having come across this myself recently, it looks like you have to enable filtering by meta_key and meta_value.

This post explains pretty well: https://1fix.io/blog/2015/07/20/query-vars-wp-api/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants