Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Ioannis Tsimpidis

Custom Field Filter Options Hook

I have created a column for a Custom Field (taxonomy ACF field). By default, the column renders the selected term id. Using the available hooks, I made the column to render the name of the term instead of the term_id.
Now, I want to add a DropDown Filter for this column.
Again, ACP in the filter’s dropdown options shows the term_id’s.
I am after a hook to modify the dropdown’s options to make it display the term names, but I can’t find anywhere in the documentation.
Is there anything available? If so, could you point me to the related documentation or could you provide a basic example?

2 weeks, 5 days ago
Stefan van den Dungen Gronovius
Developer

Based on your description, it sounds like you’re using the custom field column. Is that correct? In that case, you should be able to add the specific ACF column (prefixed with the green icon) or your ACF field. It should be listed int he ACF section. In that case, the term is displayed automatically and all dropdowns for editing, and filtering are automatically populated with the term names.

2 weeks, 4 days ago
Ioannis Tsimpidis

Hey Stefan!
Thanks for the input.
I don’t remember why I didn’t go with the Green Field (maybe it wasn’t returning too the data I wanted)… I will give it another try. But, in the meantime, I created my own custom DropDown Filters for that list.

Whatever the case, it would be useful to know if there are any specific hooks for the filters.

2 weeks, 4 days ago
Stefan van den Dungen Gronovius
Developer

Assuming you’re using the Custom Field column, you can play with the ‘Field Type’ to change the behavior of the value. It is even possible to set the field type to ‘Taxonomy’ which will automatically change a term ID to the name and show the list. This is also available for post/user/media.

In those cases, we run queries (get_posts , get_terms) to retrieve the records to show in the list.
Unfortunately, we don’t have custom hooks ourself to change the output but depending on what query is used, you can change the query with the internal WordPress hooks like pre_get_posts or term_arguments.

2 weeks, 4 days ago

You must be logged in to reply to this topic.