Skip to main content
6 events
when toggle format what by license comment
Jul 24, 2015 at 18:57 comment added Aadil Afzal here is my new code. function retrieve_my_terms(){ $cats = array(); global $terms; $categories = get_terms( 'destination', 'orderby=count&hide_empty=0' ); foreach($categories as $cat){ $cats[$cat->name] = $cat->name; } return $cats; } add_action('init', 'retrieve_my_terms', 9999); print_r(retrieve_my_terms()); When i call this function in templete it show values but not in functions.php which i need
Jul 24, 2015 at 18:53 comment added Aadil Afzal All code are in functions.php I just read a article here It says i use add_action but still not working for me really really upset.
Jul 24, 2015 at 18:47 comment added Josh Riser First, you can get multiple terms by using an array with the name of each term, like $categories = get_terms(array('term1', 'term2'));. Second, what is not working when you use this? Are you getting an error? Where is your meta field code at? If that is in your functions.php file (where it should be) then there shouldn't be any problems.
Jul 24, 2015 at 18:34 comment added Aadil Afzal I try your suggested code, but it not work either, i show values if i add code in any template, but it not show any value in fucntions.php file.
Jul 24, 2015 at 18:20 comment added Aadil Afzal But in this how do i specify which terms i need to retrieve, because i have 3 to 4 type of custom posts, and everyone have 2 to 3 type of taxonomy. So i have to more specify which terms i need.
Jul 24, 2015 at 13:57 history answered Josh Riser CC BY-SA 3.0