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:
ryan 2005-11-17 09:10:18 +00:00
parent 6b01b6a07a
commit d662ef80b1
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);