Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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