WordPress question,
I have custom post type
3 taxonomies
and multiple terms within each taxonomy
The below code will spit out a list of terms within “Custom_Taxonomy”
How can I make it spit out the list from “Custom_Taxonomy2” within the same custom post type ?
$terms = get_terms( 'Custom_Taxonomy' );
echo '<ul>';
foreach ( $terms as $term ) {
// The $term is an object, so we don't need to specify the $taxonomy.
$term_link = get_term_link( $term );
// If there was an error, continue to the next term.
if ( is_wp_error( $term_link ) ) {
continue;
}
// We successfully got a link. Print it out.
echo '<li><a href="' . esc_url( $term_link ) . '">' . $term->name . '</a></li>';
}
echo '</ul>';
I’ve been trying the following solutions , but none of them work , im not much of a php coder. (Please dont give me a downvote , im trying here 🙂 )
$terms = get_terms( 'Custom_Taxonomy' AND 'Custom_Taxonomy2' );
$terms = get_terms( 'Custom_Taxonomy' || 'Custom_Taxonomy2' );
$terms = get_terms( 'Custom_Taxonomy' && 'Custom_Taxonomy2' );
$terms = get_terms( 'Custom_Taxonomy', 'Custom_Taxonomy2' );
$terms = get_terms( 'Custom_Taxonomy' 'Custom_Taxonomy2' );
To fetch the results for multiple taxonomies you just pass a array into the name field