Add post_where_paged and post_join_paged filter hooks. Move posts_where and posts_join before the paging queries.

git-svn-id: http://svn.automattic.com/wordpress/trunk@2000 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rboren 2004-12-25 00:32:50 +00:00
parent 8790a95eeb
commit db7cbbdc94
1 changed files with 9 additions and 2 deletions

View File

@ -479,6 +479,11 @@ class WP_Query {
else
$where .= ')';
// Apply filters on where and join prior to paging so that any
// manipulations to them are reflected in the paging by day queries.
$where = apply_filters('posts_where', $where);
$join = apply_filters('posts_join', $join);
// Paging
if ( !empty($q['postend']) && ($q['postend'] > $q['poststart']) ) {
if ($q['what_to_show'] == 'posts') {
@ -521,9 +526,11 @@ class WP_Query {
}
}
$where = apply_filters('posts_where', $where);
// 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";
$join = apply_filters('posts_join', $join);
$join = apply_filters('posts_join_paged', $join);
$request = " SELECT $distinct * FROM $wpdb->posts $join WHERE 1=1".$where." ORDER BY post_" . $q['orderby'] . " $limits";
if ($q['preview']) {