Home › Forums › General Issues › taxonomy field – filter to only show parents › Reply To: taxonomy field – filter to only show parents
hi @elliot
I’ve just recently implemented your suggestion. Yet, as @socki03 has correctly indicated, field['name']
does not yield the correct result. If I recall correctly it actually returns the whole object array.
His suggestion of using strpos didn’t seem quite right to me (no disrespect) so I’ve done this.
if ($field['key'] == 'field_524561acf76e5')
This seems kosher (I hope) but hard-coding the field key seems to not be ideal. If I had to recreate that field (on another server for example) I’d have to update the key I imagine.
Is there a way a specific field can be targeted using the field name?
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.