WP_Query() displaying past post / event
WP_Query() displaying past post / event
WP_Query() displaying past post / event
Variable ++ in query loop
Prevent WordPress loop from displaying similar post titles
WordPress WP_Query Search (‘s’) With Multiple Search Terms
Get posts using multiple values from ACF checkbox as meta query wordpress
How can I show posts with the same tag?
get the queried_object of an url
List categories using WP_Query
The issue can be solved with this code : function my_cpt_query( $query ) { $myPostObjetField= get_field(‘cpt1_field_for_cpt2’,$post_id,false); foreach( $myPostObjetField as $post_field_item_value ) { $ids[] = (int) $post_field_item_value; } $query->set( ‘post_type’, ‘CPT2’); $query->set( ‘post__in’, $ids); } add_action( ‘elementor/query/13600’, ‘my_cpt_query’ );
For anyone visiting this topic in the future, I will form an answer of my comment. The reason for this issue was the use of $category inside the tax_query. The get_terms function return terms as entire objects by default. The tax_query expects an ID (or an array of IDs). This caused issues with the execution … Read more