Home › Forums › Backend Issues (wp-admin) › post_object and custom taxonomies
I’m trying to filter a custom post type post_object (inside a repeater) field by a custom taxonomy. I can’t see any custom taxonomies in the select box. Is the post_object field restricted to the built in “category” taxonomy or am I doing something wrong?
The field is inside a repeater and used within a custom options page. My custom post type and custom taxonomy are registered in the theme’s functions.php file and the taxonomy is assigned to my post type properly.
Hi @ojrask
The fact that you post_object field is within a repeater should make no difference. Also the location rule should not matter either. You can test this by creating a new post_object field as a root level field in the same field group.
When you edit one of your post_type posts, do you see the correct WP metabox for your taxonomy? Does the Taxonomy appear in the sidebar under your post_type?
Is your taxonomy public?
Hello,
Yes, the custom taxonomy is visible and usable on each custom post edit page. It can be queried just fine everywhere else on the site.
Could this be a problem with custom capabilities assigned to my custom post type (nothing spectacular, just renames “edit_posts” to “edit_cpts” and so on)?
EDIT:
Read through the core plugin code and noticed this line of code in the function that populates the select choices (get_taxonomies_for_select
in acf.php
) for the taxonomy filter:
if(!is_taxonomy_hierarchical($taxonomy)) continue;
I have my taxonomy as non-hierarchical and this seems to be the problem. I can’t seem to remember any notice of this on the field’s documentation page?
Luckily my taxonomy will work about the same even if it is not non-hierachical, but will there be an update to allow filtering with these taxonomies too?
Hi @ojrask
Yes, ACF only allows hierarchical taxonomies to effect the post’s field groups.
I will consider adding in a filter to add custom taxonomies and even allow tag based taxonomies in the future.
Thanks
E
The topic ‘post_object and custom taxonomies’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.