Home › Forums › Backend Issues (wp-admin) › ACF load_field preventing custom taxonomy checkboxes from staying checked › Reply To: ACF load_field preventing custom taxonomy checkboxes from staying checked
My guess is that the loop in your function is interfering is some way with the global $post value. This can be caused by many things. I actually just had a similar problem on a site myself and it took me a long time to track it down.
My suggestion, to rule this out, would be to not use have_posts() and the_post() at all and instead to access the post information a different way.
if (count($sectors->posts)) {
foreach ($sectors->posts as $post) {
// vars
$value = $post->ID;
$label = ucfirst(str_replace('Fabrication for ', '', $post->post_title));
// append to choices
$field['choices'][ $value ] = $label;
}
}
you should not use wp_reset_postdata() if you use the above code
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.