I am very new to coding.The following code is working fine which shows the post which has taxonomy "persons", but when I am using second part then it is not showing the content.What I want is to show the post which has the person and animal taxonomy terms.
$terms = wp_get_post_terms( $post->ID, 'persons' );
$term_slugs = wp_list_pluck( $terms, 'slug' );
'tax_query' => array(
array(
'taxonomy' => 'persons',
'field' => 'id',
'terms' => $term_slugs
)
),
Second part:
$terms = wp_get_post_terms( $post->ID, 'persons' );
$term_slugs = wp_list_pluck( $terms, 'slug' );
$terms2 = wp_get_post_terms( $post->ID, 'animal' );
$term_slugs2 = wp_list_pluck( $terms, 'slug' );
'tax_query' => array(
array(
'taxonomy' => 'persons',
'field' => 'id',
'terms' => $term_slugs
),
array(
'taxonomy' => 'animal',
'field' => 'id',
'terms' => $term_slugs2
)
),