Support

Account

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.