Filtering by ACF Field

Using the new filter block for ACF field settings doesn’t appear to be possible at the moment. Am I missing something?

Hi @avunu,

If you mean using data from an ACF Field in the filter block, that’s correct. We will be adding support soon.
But you can still filter any kind of ACF Field within a Query parameter.

Hey @Louis, thanks for your followup.

Can you please elaborate what you mean by “filter any kind of ACF Field within a Query parameter”?

I have a post custom field of type “True / False” that I’d like to filter on the frontend using a corresponding checkbox filter. Is this possible at the moment?

Thanks

Hi there @avunu,

Most definitely this should be possible if you can already do so through the Query builder.

What the filter does is just bring the data (in your case false/true) to the Query arguments.

1 Like

Okay, so please excuse my ignorance here, but I can’t figure out how to accomplish what you’re indicating.

Here’s my scenario:

I have a true/false ACF field on a custom post type configured as such:
image

Then I have a filter for my query set to manually correspond with that field:
image

On my Query itself, the only thing I could figure out to use was a meta query in the absence of a built-in ACF field filter:

I can’t get this or any obvious variations of this to work. What am I doing wrong?

Thanks!

using data from aACF Fields as filter parameters, this is definite usefully.

Sorry to be a nag @Louis, but if you have any insight on the above I’d appreciate it!

Hi @avunu,

Sorry for the wait.

This is a bit trickier than I first expected because of the way we currently can’t have one filter value modify two query parameters (Meta Value and Meta Compare would have to be modified → Meta Compare set to NOT EXIST if you wanted to query FALSE).

Please bear with me while I give this a bit more thought and see where we can go with it.

3 Likes

I got the query to work with a static filter (meta query but not filter block).

ACF true/false fields are stored as 1/0 in the database, but digits don’t seem to save at the moment when entered into the “Meta Value” field in a Quickly Meta Query dialog. This is what I finally found as a workaround:
image

I still have no success with using the filter block for this.

Yes this is a possibility, but requires you to have the post saved with the specific premium key saved as false/true. It won’t show posts that are false but haven’t had the value applied yet (if the field was created aftermath).

Filtering for this works fine on my side… What is the issue?