Latest posts with same terms of the current post
-
Hi.
Inside of an article, I’d like to show the latest 3 recipes with the same “ingredients” of the current post.
I have this code:$terms = get_the_term_list( $post->ID, 'ingredients' ); $args = array( 'posts_per_page' => 3, 'post_type' => 'recipe', 'tax_query' => array( array( 'taxonomy' => 'ingredients', 'field' => 'slug', 'terms' => array( $terms ) ) ) ); $the_query = new WP_Query( $args );
The variable $terms is not correct, I wrote it for example…
How can I show 3 posts whit the same terms of the current post?
Thanks.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Latest posts with same terms of the current post’ is closed to new replies.