From 1e15c956468e210e2db5e5f30160c4f144be96e8 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Sat, 25 Dec 2004 00:32:50 +0000 Subject: [PATCH] Add post_where_paged and post_join_paged filter hooks. Move posts_where and posts_join before the paging queries. git-svn-id: https://develop.svn.wordpress.org/trunk@2000 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/classes.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/wp-includes/classes.php b/wp-includes/classes.php index db8ca06a2c..be70578232 100644 --- a/wp-includes/classes.php +++ b/wp-includes/classes.php @@ -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']) {