Created
March 12, 2018 14:29
-
-
Save alimoshen/905abbb069219cd66fa13b6cf4efc383 to your computer and use it in GitHub Desktop.
Get Custom Taxonomy Term Data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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