• Resolved joeblk

    (@joeblk)


    Hi,
    Many thanks for this useful plugin!

    I’m trying to filter a simple true/false checkbox that I put on my pages with ACF, with this query which comes out empty:
    /wp-json/wp/v2/pages?filter[meta_key]=appevents&filter[meta_value]=true

    If I’m creating a meta field directly with WP, I can do the key AND value filtering, and this one is correctly displaying the pages that I tested my checkbox with:
    /wp-json/wp/v2/pages?filter[meta_key]=appevents

    I’m not sure where I could have made a mistake in my ACF config, as it only has a rule to check if it’s a page, and a true/false field which has “appevents” as its name. I tried using another type of field, but it changed nothing.

    Am I getting something wrong here?

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter joeblk

    (@joeblk)

    I can make it work by using a manual textfield, and filtering for a specific text:
    /wp-json/wp/v2/pages?filter[meta_key]=appevents&filter[meta_value]=oui

    So the problem is that the TRUE/FALSE ACF component doesn’t store the field as the text “true”, right?

    Anyway, this is a minor inconvenience, thanks again for the plugin!

    PS: Sorry if my english is bad, I’m french.

    • This reply was modified 6 years, 8 months ago by joeblk.
    Plugin Author sk8tech

    (@sk8tech)

    Hello, thanks for your message. We’ve encountered similar issue before. I’ve added it to future roadmap.

    For your question, sometime ACF stores boolean value as 0 & 1, can you please verify if ‘/wp-json/wp/v2/pages?filter[meta_key]=appevents&filter[meta_value]=1’ works?

    Thread Starter joeblk

    (@joeblk)

    Yep, it’s working! Thank you very much.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘ACF field filtering not working’ is closed to new replies.