Add posts_groupby and posts_request filters. fixes #1479
git-svn-id: http://svn.automattic.com/wordpress/trunk@3130 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6b01b6a07a
commit
d662ef80b1
|
@ -601,11 +601,13 @@ class WP_Query {
|
|||
// Apply post-paging filters on where and join. Only plugins that
|
||||
// manipulate paging queries should use these hooks.
|
||||
$where = apply_filters('posts_where_paged', $where);
|
||||
$where .= " GROUP BY $wpdb->posts.ID";
|
||||
$groupby = " $wpdb->posts.ID ";
|
||||
$groupby = apply_filters('posts_groupby', $groupby);
|
||||
$join = apply_filters('posts_join_paged', $join);
|
||||
$orderby = "post_" . $q['orderby'];
|
||||
$orderby = apply_filters('posts_orderby', $orderby);
|
||||
$request = " SELECT $distinct * FROM $wpdb->posts $join WHERE 1=1".$where." ORDER BY " . $orderby . " $limits";
|
||||
$request = " SELECT $distinct * FROM $wpdb->posts $join WHERE 1=1" . $where . " GROUP BY " . $groupby . " ORDER BY " . $orderby . " $limits";
|
||||
$request = apply_filters('posts_request', $request);
|
||||
|
||||
$this->posts = $wpdb->get_results($request);
|
||||
|
||||
|
|
Loading…
Reference in New Issue