WP_Query passing the term in the query

Viewed 43

I'm using wp_query to build a list of posts from my CPT, however I need to filter this list by it's term, I can run a tax query which again is fine.

However I also need the term to be in the array of the query for each post.

Is this possible?

1 Answers

i think you can you can use below code to show terms inside loop.

$term_list = wp_get_post_terms( $postId, 'my_taxonomy', array( 'fields' => 'all' ) );
Related