Combined Query – version 1.2.0
Updated the WordPress plugin – Combined Query
It’s a plugin that combines multiple WP_Query() queries into a single one, through the custom ‘combined_query’ attribute of the WP_Query class:
//---------------------------
// Combined queries #1 + #2:
//---------------------------
$args = [
'combined_query' => [
'args' => [ $args1, $args2 ],
'union' => 'UNION',
'posts_per_page' => 4,
'orderby' => 'none',
]
];
//---------
// Output:
//---------
$q = new WP_Query( $args );
https://github.com/birgire/wp-combine-queries
1.2.0 (2020-09-14)
- Added: Support for ordering by ‘none’.
- Added: Test cases.
- Added: Support for adding parameters (posts_per_page, offset, orderby, order) inside combined_query args.
- Fixed: Hooks handling for pre_get_posts example.
- Adjusted: Examples.