Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm currently using Advanced Custom Fields and I was wondering if anyone know how to filter categories by custom fields? I have a custom field in my categories using the checkboxes field. I want to make a page that will list categories that contain a specific checkbox field that is ticked. For example I have 3 checkboxes in my categories which are Romance,Action & Drama. I have ticked checkbox Action and I want to list categories on the page that have ticked checkbox Drama.

It is kind of similar to this tutorial http://www.advancedcustomfields.com/resources/how-to/how-to-query-posts-filtered-by-custom-field-values/ except I want to get categories instead of posts. What’s the easiest way to do this cause I’m not a programmer?

share|improve this question

2 Answers 2

up vote 1 down vote accepted
+50

Try something like this :

   $value = get_field('field_name');

Try whole process based on this http://www.advancedcustomfields.com/resources/how-to/filter-posts-by-custom-fields/

   $value = get_field('field_name', $category->cat_ID);
share|improve this answer

The issue is that there is no taxonomy meta data like there is for posts. ACF taxonomy data is stored serialized in the options table, so it can't be queried like post meta can. You have to load all terms and check the data associated to each one individually.

Perhaps a better solution is to create Romance, Action, & Drama parent terms, and make your other terms children of one of those parents.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.