Astrid
Astrid

Reputation: 125

WP_Query passing the term in the query

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?

Upvotes: 2

Views: 72

Answers (1)

Er Deepak Prabhakar
Er Deepak Prabhakar

Reputation: 458

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' ) );

Upvotes: 3

Related Questions