简体   繁体   中英

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?

我认为您可以使用以下代码在循环中显示术语。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM