name ] = $taxonomy_object; } } return $return; } /** * acfe_get_taxonomy_terms_ids * * Similar to acf_get_taxonomy_terms() * Returns "array('256' => 'Category name')" instead of "array('category:category_name' => 'Category name')" * * @param array $taxonomies * * @return array */ function acfe_get_taxonomy_terms_ids($taxonomies = array()){ // force array $taxonomies = acfe_as_array($taxonomies); // get pretty taxonomy names $taxonomies = acf_get_taxonomy_labels($taxonomies); // vars $r = array(); // populate $r foreach(array_keys($taxonomies) as $taxonomy){ // vars $label = $taxonomies[ $taxonomy ]; $is_hierarchical = is_taxonomy_hierarchical($taxonomy); $terms = acf_get_terms(array( 'taxonomy' => $taxonomy, 'hide_empty' => false )); // bail early if no terms if(empty($terms)){ continue; } // sort into hierachial order! if($is_hierarchical){ $terms = _get_term_children(0, $terms, $taxonomy); } // add placeholder $r[ $label ] = array(); // add choices foreach($terms as $term){ $r[ $label ][ $term->term_id ] = acf_get_term_title($term); } } // return return $r; } /** * acfe_get_term_level * * Retrive the Term Level number * * @param $term * @param $taxonomy * * @return int */ function acfe_get_term_level($term, $taxonomy){ $ancestors = get_ancestors($term, $taxonomy); return count($ancestors) + 1; }