WordPress search WP_Query to cover multiple post types and their custom fields?

Found a way to combine WP_Query posts: $query1 = new WP_Query($args); $query2 = new WP_Query($args2); $query3 = new WP_Query($args3); $combined = new WP_Query(); $combined->posts = array_merge( $query1->posts ,$query2->posts ,$query3->posts ); Still not as elegant as doing one WP_Query with all those conditions in args being an OR … as in the query should match ANY … Read more

Why my query is not “Main_query”?

And the anwser to my question: Don’t make new WP_Query object. Don’t try to overwrite main query. Use global $wp_query; In my example the function should be like this: public function askanban_display_board(){ global $wp_query; $wp_query->set(‘post_type’, ‘ticket’); $wp_query->set(‘posts_per_page’, -1); $posts = $wp_query->get_posts(); print_r($posts); }