Skip to content

Instantly share code, notes, and snippets.

@alimoshen
Created March 12, 2018 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alimoshen/905abbb069219cd66fa13b6cf4efc383 to your computer and use it in GitHub Desktop.
Save alimoshen/905abbb069219cd66fa13b6cf4efc383 to your computer and use it in GitHub Desktop.
Get Custom Taxonomy Term Data
<?php
$taxonomyTerm = get_terms(
'custom_taxonomy_name',
array(
'parent'=> 0,
'orderby' => 'date',
'hide_empty' => 0,
'number' => 3 //Number of items
)
);
if ( ! empty( $taxonomyTerm ) && ! is_wp_error( $taxonomyTerm ) ){
foreach ( $taxonomyTerm as $taxonomyTerms ) {
echo 'Slug is'.$taxonomyTerm->slug;
echo 'Title is'.$taxonomyTerm->name;
echo 'ID is'.$taxonomyTerm->term_id;
echo 'Description is'.$taxonomyTerm->description;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment