Home › Forums › Backend Issues (wp-admin) › Issue / Change with Location Rules in ACF 5 › Reply To: Issue / Change with Location Rules in ACF 5
Sure thing, here you go: https://gist.github.com/wunderdojo/e0d5ef75dc76609f32de9eabc324306a
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.
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.