Search results for ""

Sorry, no results found. Perhaps you would like to search the community forum?
All Topics

Adding Filter for ACF Field Group

Okay, I have a column for an ACF Field Group. ACF Field Groups are not supported by ACP. So it shows “array” in the column.

No big deal, I write my own code for the column using the “ac/column/value” filter and it shows the data I want it to show.

However, now I want to create a filter dropdown for that column. And I can’t figure it out from the documentation. Or is this a “WordPress” thing and not an ACP thing?

5 days, 22 hours ago

I’m not 100% sure, but if I’m correct, the ACF group fields are just stored as a separate custom field, so you could try to use the Custom Field column instead of the ACF column and look for the related subfield as key. If that works, filtering should also work. Otherwise, you probably want to create your own column.

Creating a new column type

This would be the best way to attach custom feature logic to your column. It’s not possible to change the behavior of the already attached ACF column.

Unfortunately, the toolkit does not contain an example of a custom filter model or Smart Filtering comparison (yet). And you’ll have to create your own model/comparison and write your own logic on how WP_query should be manipulated to filter the data. If you’re interested, please let me know and I can point you in the right direction.

5 days, 5 hours ago

What I really need is code for creating a custom filter dropdown in WordPress. If I can get the filter dropdown created, I think I can figure out the rest.

19 hours, 39 minutes ago

There is not really a default way to do this easily in WordPress.
You’ll have to write your own drop-downs and catch all logic in the pre_get_posts filter.
At this moment we have two different implementations of this in both our Filtering and Smart filtering feature.
So if you really want to custom code, you’ll have to put your drop down and filtering logic in the following hooks. (here goes the drop downs) (here you do the filter logic)

5 hours, 13 minutes ago

You must be logged in to reply to this topic.