Query ACF relationship field – Comparator IN – Value array
Query ACF relationship field – Comparator IN – Value array
Query ACF relationship field – Comparator IN – Value array
Woocommerce Shortcode which displays a table with product data
Tax Query on product_cat using NOT IN as operator does not exclude that category
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
Exclude post with taxonomy and from the terms (taxonomy & tag) posts count
Filter sub-category from checkbox form
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); }
WP_Query return posts in wrong order
Where did you put that function ? that’s better call that it inside the action, the error probably coming from missing variable. add_action(‘init’,’newFunction’); function newFunction(){ global $wp_query; // Do your code here }
WP Query Order By Multiple Values