Home › Forums › General Issues › Custom taxonomies are not fetched with acf › Reply To: Custom taxonomies are not fetched with acf
When is add_local_field_group called, before or after “init” when the taxonomy is added. I suspect that you are attempting to get the terms in the taxonomy before the taxonomy has been initialized.
function get_terms_for_acf_select() {
$terms = get_terms(array('taxonomy' => 'teams', 'hide_empty' => false));
if (is_wp_error($terms)) {
die ('WP Error Getting Terms');
}
$options = array();
if (is_array($terms)) {
foreach ($terms as $term) {
if (is_object($term)) {
$options[$term->term_id] = $term->term_id;
}
}
}
return $options;
}
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.