Remove extraneous sanitization of category_name. Leave it to wp_tax_query(). See #12891

git-svn-id: http://svn.automattic.com/wordpress/trunk@15625 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
scribu 2010-09-17 17:07:11 +00:00
parent 367e4916ee
commit 17c867e74b
1 changed files with 4 additions and 25 deletions

View File

@ -1877,35 +1877,14 @@ class WP_Query {
// Category stuff for nice URLs
if ( '' != $q['category_name'] && !$this->is_singular ) {
$q['category_name'] = implode('/', array_map('sanitize_title', explode('/', $q['category_name'])));
$reqcat = get_category_by_path($q['category_name']);
$q['category_name'] = str_replace('%2F', '/', urlencode(urldecode($q['category_name'])));
$cat_paths = '/' . trim($q['category_name'], '/');
$q['category_name'] = sanitize_title(basename($cat_paths));
$cat_paths = '/' . trim(urldecode($q['category_name']), '/');
$q['category_name'] = sanitize_title(basename($cat_paths));
$cat_paths = explode('/', $cat_paths);
$cat_path = '';
foreach ( (array) $cat_paths as $pathdir )
$cat_path .= ( $pathdir != '' ? '/' : '' ) . sanitize_title($pathdir);
//if we don't match the entire hierarchy fallback on just matching the nicename
if ( empty($reqcat) )
$reqcat = get_category_by_path($q['category_name'], false);
if ( !empty($reqcat) )
$reqcat = $reqcat->term_id;
else
$reqcat = 0;
$q['cat'] = $reqcat;
$q['category_name'] = str_replace( '%2F', '/', urlencode(urldecode($q['category_name'])) );
$q['category_name'] = '/' . trim( $q['category_name'], '/' );
$tax_query[] = array(
'taxonomy' => 'category',
'terms' => array( $q['cat'] ),
'terms' => array( basename( $q['category_name'] ) ),
'operator' => 'IN',
'field' => 'term_id'
'field' => 'slug'
);
}