Init strings before concatenation. Props devil1591. fixes #3457

git-svn-id: https://develop.svn.wordpress.org/trunk@4634 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith 2006-12-09 06:35:22 +00:00
parent f769cec548
commit d4c163f52b
2 changed files with 6 additions and 4 deletions

View File

@ -169,8 +169,9 @@ function get_category_by_path($category_path, $full_match = true, $output = OBJE
$category_paths = '/' . trim($category_path, '/');
$leaf_path = sanitize_title(basename($category_paths));
$category_paths = explode('/', $category_paths);
foreach($category_paths as $pathdir)
$full_path .= ($pathdir!=''?'/':'') . sanitize_title($pathdir);
$full_path = '';
foreach ( (array) $category_paths as $pathdir )
$full_path .= ( $pathdir != '' ? '/' : '' ) . sanitize_title($pathdir);
$categories = $wpdb->get_results("SELECT cat_ID, category_nicename, category_parent FROM $wpdb->categories WHERE category_nicename = '$leaf_path'");

View File

@ -819,8 +819,9 @@ class WP_Query {
$cat_paths = '/' . trim(urldecode($q['category_name']), '/');
$q['category_name'] = sanitize_title(basename($cat_paths));
$cat_paths = explode('/', $cat_paths);
foreach($cat_paths as $pathdir)
$cat_path .= ($pathdir!=''?'/':'') . sanitize_title($pathdir);
$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) )