Try this:
$post_terms = wp_get_object_terms($post->ID, 'your-taxonomy', array('fields'=>'ids'));
$args = array(
'post_type' => 'current-products',
'tax_query' => array(
array(
'taxonomy' => 'your-taxonomy',
'field' => 'id',
'terms' => $post_terms
)
)
);
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) {
echo '<ul>';
while ( $the_query->have_posts() ) {
$the_query->the_post();
?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php
}
echo '</ul>';
} else {
// no posts found
}
wp_reset_postdata();
You should replace occurrences of your-taxonomy
in the code with your taxonomy type in order this code to work.