Ticket #4799: query_hooks.diff
| File query_hooks.diff, 1.7 KB (added by ryan, 6 years ago) |
|---|
-
wp-includes/query.php
1128 1128 } 1129 1129 1130 1130 // Apply post-paging filters on where and join. Only plugins that 1131 // manipulate paging queries should use these hooks. 1131 // manipulate paging queries should use these hooks. 1132 1133 // Announce current selection parameters. For use by caching plugins. 1134 do_action( 'posts_selection', $where . $groupby . $q['orderby'] . $limits . $join ); 1135 1132 1136 $where = apply_filters('posts_where_paged', $where); 1133 1137 $groupby = apply_filters('posts_groupby', $groupby); 1134 1138 if ( ! empty($groupby) ) 1135 1139 $groupby = 'GROUP BY ' . $groupby; 1136 1140 $join = apply_filters('posts_join_paged', $join); 1137 1141 $orderby = apply_filters('posts_orderby', $q['orderby']); 1142 if ( !empty( $orderby ) ) 1143 $orderby = 'ORDER BY ' . $orderby; 1138 1144 $distinct = apply_filters('posts_distinct', $distinct); 1139 1145 $fields = apply_filters('posts_fields', "$wpdb->posts.*"); 1140 1146 $limits = apply_filters( 'post_limits', $limits ); … … 1142 1148 if ( !empty($limits) ) 1143 1149 $found_rows = 'SQL_CALC_FOUND_ROWS'; 1144 1150 1145 $request = " SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby ORDER BY$orderby $limits";1151 $request = " SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits"; 1146 1152 $this->request = apply_filters('posts_request', $request); 1147 1153 1148 1154 $this->posts = $wpdb->get_results($this->request); 1155 // Raw results filter. Prior to status checks. 1156 $this->posts = apply_filters('posts_results', $this->posts); 1149 1157 1150 1158 if ( $this->is_comment_feed && $this->is_singular ) { 1151 1159 $cjoin = apply_filters('comment_feed_join', '');
