Home › Forums › Backend Issues (wp-admin) › Limit post-object field to only top-level taxonomy terms? › Reply To: Limit post-object field to only top-level taxonomy terms?
I modified the post_object.php field to accomplish this. It’s attached.
There is a method called acf_get_taxonomy_terms() that is getting all the terms for the options. I pulled that function from the api-helpers.php file and updated it slightly to include the ‘parent’ => 0 parameter in its get_terms() call. I put the new method in my updated file and called it instead of acf_get_taxonomy_terms() and it seems to work as expected. Adding it as a new field option is the easiest way. Look at Creating a New Field Type to see how to do that. For this though, you can just add the attached file to your system (I just included it at the bottom of my functions.php file) and it should become available.
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.