Ticket #4065 (new task)

Opened 2 years ago

Last modified 9 months ago

useful function: merge_wp_queries()

Reported by: markjaquith Assigned to: anonymous
Priority: low Milestone: 2.9
Component: Optimization Version:
Severity: normal Keywords: needs-patch
Cc:

Description

It would be really handy if you could take two WP_Query objects and merge them. Duplicate posts would be removed, and you could choose a sort column and sort order.

Example usage:

$q1 = new WP_Query('monthnum=12&year=2006');
$q2 = new WP_Query('monthnum=1&year=2007');
$merged = merge_wp_queries($q1, $q2, 'post_date_gmt', 'desc');

Change History

02/14/08 15:55:59 changed by darkdragon

  • component changed from Administration to Optimization.
  • milestone changed from 2.5 to 2.6.

Bumping to 2.6 because of feature freeze and no patch.

02/14/08 15:56:42 changed by darkdragon

As an aside, this would be extremely useful, so I look forward to trying my hand on a patch for 2.6.