Thanks for any help.
I am in a custom post (not an archive) with a taxonomy. And I'd like to display :
- some other custom posts
- with this current taxonomy
Doesn't seems so hard but for me it does... I didn't find the right way to use the term of my tax in the query...
Here is (one of) my try :
$terms = wp_get_post_terms( $post->ID, 'identite'); // to get my taxonomy foreach ( $terms as $term ) { echo "$term->slug"; // just for test - ok $args = array( 'post_type' => 'example', 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'identite', 'field' => 'ID', 'terms' => $terms ) ), );// end args $query = new WP_Query( $args); if ( $query->have_posts() ) { while ( $query->have_posts() ) { $query->the_post(); // Little pray, but doesn't work }//end of while }
I obtain this error message : Object of class WP_Term could not be converted to int in
Any idea to convert my object and make it readable ? Thanks a lot
(edit : I try with the function wp_list_pluck but without success)