From 093d13ed1cd91e2556650eafab563f049c1817b8 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Sun, 13 Feb 2005 17:52:58 +0000 Subject: [PATCH] Allow category and date filtering to coincide. Allow any number of spaces or commas to serve as item separators in the category and author arrays. http://mosquito.wordpress.org/view.php?id=221 git-svn-id: https://develop.svn.wordpress.org/trunk@2295 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/classes.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/wp-includes/classes.php b/wp-includes/classes.php index 1c1f49b7dd..034b2430ca 100644 --- a/wp-includes/classes.php +++ b/wp-includes/classes.php @@ -353,11 +353,7 @@ class WP_Query { if ((empty($q['cat'])) || ($q['cat'] == '0') || // Bypass cat checks if fetching specific posts - ( - intval($q['year']) || intval($q['monthnum']) || intval($q['day']) || intval($q['w']) || - intval($q['p']) || !empty($q['name']) || !empty($q['s']) - ) - ) { + ( is_single() || is_page() )) { $whichcat=''; } else { $q['cat'] = ''.urldecode($q['cat']).''; @@ -375,7 +371,7 @@ class WP_Query { $andor = 'OR'; } $join = " LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) "; - $cat_array = explode(' ',$q['cat']); + $cat_array = preg_split('/[,\s]+/', $q['cat']); $whichcat .= ' AND (category_id '.$eq.' '.intval($cat_array[0]); $whichcat .= get_category_children($cat_array[0], ' '.$andor.' category_id '.$eq.' '); for ($i = 1; $i < (count($cat_array)); $i = $i + 1) { @@ -424,7 +420,7 @@ class WP_Query { $eq = '='; $andor = 'OR'; } - $author_array = explode(' ', $q['author']); + $author_array = preg_split('/[,\s]+/', $q['author']); $whichauthor .= ' AND (post_author '.$eq.' '.intval($author_array[0]); for ($i = 1; $i < (count($author_array)); $i = $i + 1) { $whichauthor .= ' '.$andor.' post_author '.$eq.' '.intval($author_array[$i]);