Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Custom Tax
<?php
$query = new WP_Query(array('post_type' => 'custom-post-type'));
while ($query->have_posts()) : $query->the_post();
$terms = get_the_terms( $post->id, 'custom-taxonomy' ); // registered custom taxonomy in custom post type
$term_description = array();
$term_name = array();
if($terms)
{
foreach( $terms as $term ) {
$term_slug[] = $term->slug; // save the slugs in an array
$term_name[] = $term->name; // save the slugs in an array
}
} //end count terms conditional.
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.