Home › Forums › Backend Issues (wp-admin) › How to dynamically remove choices from select field? › Reply To: How to dynamically remove choices from select field?
are ad_zones and field_59772109bf9d4 the same field? If they are then this is creating the infinite loop. You need to remove the filter at the beginning and add it again at the end so that the filter does not run when getting values from itself in other instances.
function acf_load_ad_zones_choices( $field ) {
remove_filter(acf/load_field/key=field_59772109bf9d4', 'acf_load_ad_zones_choices');
// the rest of your function
add_filter('acf/load_field/key=field_59772109bf9d4', 'acf_load_ad_zones_choices');
return $field;
}
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.