Ads by ProfitSence
Close

Get all taxonomy terms WordPress

Last Updated on Wednesday 5th Oct 2022

wordpress get taxonomy terms

  • Get all taxonomy terms for custom post type is simple and done from a one single line of code.

My Taxonomy is Languages

			
					$languages = get_terms('languages');

			
	
  • Now You Have a list all taxonomy terms within WordPress.

You Can Loop through it.

			
					foreach ($languages as $language) {
   echo '<h2>'. $language->name . '</h2>';
}

			
	
			
					$terms = get_terms(array(
  'taxonomy' => 'name/taxo',
  'hide_empty' => true,
));

			
	
			
					foreach ($terms as $term){
  echo $term->slug;
  echo $term->name;
  echo "<br><br>";
}

			
	

References