Cleanup cat query var
git-svn-id: http://svn.automattic.com/wordpress/trunk@7511 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6054151013
commit
8f35f1a817
|
@ -990,8 +990,11 @@ class WP_Query {
|
||||||
$q['cat'] = ''.urldecode($q['cat']).'';
|
$q['cat'] = ''.urldecode($q['cat']).'';
|
||||||
$q['cat'] = addslashes_gpc($q['cat']);
|
$q['cat'] = addslashes_gpc($q['cat']);
|
||||||
$cat_array = preg_split('/[,\s]+/', $q['cat']);
|
$cat_array = preg_split('/[,\s]+/', $q['cat']);
|
||||||
|
$q['cat'] = '';
|
||||||
|
$req_cats = array();
|
||||||
foreach ( $cat_array as $cat ) {
|
foreach ( $cat_array as $cat ) {
|
||||||
$cat = intval($cat);
|
$cat = intval($cat);
|
||||||
|
$req_cats[] = $cat;
|
||||||
$in = ($cat > 0);
|
$in = ($cat > 0);
|
||||||
$cat = abs($cat);
|
$cat = abs($cat);
|
||||||
if ( $in ) {
|
if ( $in ) {
|
||||||
|
@ -1002,6 +1005,7 @@ class WP_Query {
|
||||||
$q['category__not_in'] = array_merge($q['category__not_in'], get_term_children($cat, 'category'));
|
$q['category__not_in'] = array_merge($q['category__not_in'], get_term_children($cat, 'category'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$q['cat'] = implode(',', $req_cats);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty($q['category__in']) || !empty($q['category__not_in']) || !empty($q['category__and']) ) {
|
if ( !empty($q['category__in']) || !empty($q['category__not_in']) || !empty($q['category__and']) ) {
|
||||||
|
|
Loading…
Reference in New Issue