One key thing to note is that for my use case there is a custom post type called Products. Products have a custom taxonomy, Fee Type. Each product should only have a single fee type associated with it so in line 71 I’m using array_pop to grab the last value from the taxonomy array that ACF is returning.
In other words, ACF returns an array like ( 0=> , 1 => 8 ). In my use case there will only ever be a single taxonomy selected so I just grab the second (last) value in the array. If you allow multiple taxonomies you’d want to switch the comparison logic to use in_array() or keep it as is but loop through for each value in the array.
Gotcha, thanks for responding. If I get a free moment before you get a chance to do anything with it I’ll slap together a variation using slug and send you the code. In a dev -> staging -> production environment term ID is likely to get out of sync while term slug you have some degree of control over, espec. if you preface them in a consistent and unique way (ie: dojo-some-term-slug).
Plus 1 on this request. It wasn’t clear to me from the docs that the fields added via PHP wouldn’t show. I took it to mean that would only be the case if I specifically disabled the UI. Would be really helpful to have the option to show them.
Viewing 5 posts - 1 through 5 (of 5 total)
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users