mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Don't require category__in, tag__in etc. to be arrays necessarily. Fixes #14892
git-svn-id: http://svn.automattic.com/wordpress/trunk@15626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
17c867e74b
commit
168659371d
@ -1286,34 +1286,30 @@ class WP_Query {
|
||||
if ( empty($qv['cat']) || ($qv['cat'] == '0') ) {
|
||||
$this->is_category = false;
|
||||
} else {
|
||||
if ( strpos($qv['cat'], '-') !== false ) {
|
||||
$this->is_category = false;
|
||||
} else {
|
||||
$this->is_category = true;
|
||||
}
|
||||
$this->is_category = strpos($qv['cat'], '-') !== false;
|
||||
}
|
||||
|
||||
if ( '' != $qv['category_name'] ) {
|
||||
if ( !empty($qv['category_name']) ) {
|
||||
$this->is_category = true;
|
||||
}
|
||||
|
||||
if ( !is_array($qv['category__in']) || empty($qv['category__in']) ) {
|
||||
if ( empty($qv['category__in']) ) {
|
||||
$qv['category__in'] = array();
|
||||
} else {
|
||||
$qv['category__in'] = array_map('absint', $qv['category__in']);
|
||||
$qv['category__in'] = array_map('absint', (array) $qv['category__in']);
|
||||
$this->is_category = true;
|
||||
}
|
||||
|
||||
if ( !is_array($qv['category__not_in']) || empty($qv['category__not_in']) ) {
|
||||
if ( empty($qv['category__not_in']) ) {
|
||||
$qv['category__not_in'] = array();
|
||||
} else {
|
||||
$qv['category__not_in'] = array_map('absint', $qv['category__not_in']);
|
||||
$qv['category__not_in'] = array_map('absint', (array) $qv['category__not_in']);
|
||||
}
|
||||
|
||||
if ( !is_array($qv['category__and']) || empty($qv['category__and']) ) {
|
||||
if ( empty($qv['category__and']) ) {
|
||||
$qv['category__and'] = array();
|
||||
} else {
|
||||
$qv['category__and'] = array_map('absint', $qv['category__and']);
|
||||
$qv['category__and'] = array_map('absint', (array) $qv['category__and']);
|
||||
$this->is_category = true;
|
||||
}
|
||||
|
||||
@ -1321,40 +1317,40 @@ class WP_Query {
|
||||
$this->is_tag = true;
|
||||
|
||||
$qv['tag_id'] = absint($qv['tag_id']);
|
||||
if ( !empty($qv['tag_id']) )
|
||||
if ( !empty($qv['tag_id']) )
|
||||
$this->is_tag = true;
|
||||
|
||||
if ( !is_array($qv['tag__in']) || empty($qv['tag__in']) ) {
|
||||
if ( empty($qv['tag__in']) ) {
|
||||
$qv['tag__in'] = array();
|
||||
} else {
|
||||
$qv['tag__in'] = array_map('absint', $qv['tag__in']);
|
||||
$qv['tag__in'] = array_map('absint', (array) $qv['tag__in']);
|
||||
$this->is_tag = true;
|
||||
}
|
||||
|
||||
if ( !is_array($qv['tag__not_in']) || empty($qv['tag__not_in']) ) {
|
||||
if ( empty($qv['tag__not_in']) ) {
|
||||
$qv['tag__not_in'] = array();
|
||||
} else {
|
||||
$qv['tag__not_in'] = array_map('absint', $qv['tag__not_in']);
|
||||
$qv['tag__not_in'] = array_map('absint', (array) $qv['tag__not_in']);
|
||||
}
|
||||
|
||||
if ( !is_array($qv['tag__and']) || empty($qv['tag__and']) ) {
|
||||
$qv['tag__and'] = array();
|
||||
} else {
|
||||
$qv['tag__and'] = array_map('absint', $qv['tag__and']);
|
||||
$this->is_category = true;
|
||||
}
|
||||
|
||||
if ( !is_array($qv['tag_slug__in']) || empty($qv['tag_slug__in']) ) {
|
||||
$qv['tag_slug__in'] = array();
|
||||
} else {
|
||||
$qv['tag_slug__in'] = array_map('sanitize_title', $qv['tag_slug__in']);
|
||||
$qv['tag__and'] = array_map('absint', (array) $qv['tag__and']);
|
||||
$this->is_tag = true;
|
||||
}
|
||||
|
||||
if ( !is_array($qv['tag_slug__and']) || empty($qv['tag_slug__and']) ) {
|
||||
if ( empty($qv['tag_slug__in']) ) {
|
||||
$qv['tag_slug__in'] = array();
|
||||
} else {
|
||||
$qv['tag_slug__in'] = array_map('sanitize_title', (array) $qv['tag_slug__in']);
|
||||
$this->is_tag = true;
|
||||
}
|
||||
|
||||
if ( empty($qv['tag_slug__and']) ) {
|
||||
$qv['tag_slug__and'] = array();
|
||||
} else {
|
||||
$qv['tag_slug__and'] = array_map('sanitize_title', $qv['tag_slug__and']);
|
||||
$qv['tag_slug__and'] = array_map('sanitize_title', (array) $qv['tag_slug__and']);
|
||||
$this->is_tag = true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user