I'm trying to get related posts by taxonomy term. So a post tagged to 'London' would have related posts tagged to London. The code I have works if the post is tagged to a single taxonomy term only - in this case a single Location (entry_location is the taxonomy). But if I tag it to more than one (eg London and Paris), it returns no results. How do I make it accept multiple tax terms and display results from both?
This is what I have so far. It works for posts tagged with one tax term only.
<?php $this_post = $post->ID; $query = new WP_Query(array( 'post_type' => 'dir_entry', 'posts_per_page' => 10, 'orderby' => 'date', 'order' => 'DESC', 'post__not_in' => array($this_post), 'entry_location' => get_the_term_list( $post->ID, 'entry_location' )) ); while ($query->have_posts()) : $query->the_post(); ?> <li class="large-6 columns"> <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a> </li> <?php endwhile; wp_reset_query(); ?>
Thanks for any advice.