Add posts_groupby and posts_request filters. fixes #1479

git-svn-id: https://develop.svn.wordpress.org/trunk@3130 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2005-11-17 09:10:18 +00:00
parent 95cf1eb670
commit 80bc0af577
1 changed files with 4 additions and 2 deletions

View File

@ -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);