diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 32ea4c9485..f40e0723d0 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1409,7 +1409,7 @@ function check_comment($author, $email, $url, $comment, $user_ip) { } function query_posts($query) { - global $wpdb, $pagenow, $request; + global $wpdb, $pagenow, $request, $user_ID; parse_str($query); diff --git a/wp-includes/template-functions-category.php b/wp-includes/template-functions-category.php index 47e93c1fcc..cfa7bfe64e 100644 --- a/wp-includes/template-functions-category.php +++ b/wp-includes/template-functions-category.php @@ -312,11 +312,13 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde INNER JOIN $wpdb->posts ON (ID = post_id) WHERE post_status = 'publish' $exclusions GROUP BY category_id"); - foreach ($cat_counts as $cat_count) { - if (1 != intval($hide_empty) || $cat_count > 0) { - $category_posts["$cat_count->cat_ID"] = $cat_count->cat_count; - } - } + if (! empty($cat_counts)) { + foreach ($cat_counts as $cat_count) { + if (1 != intval($hide_empty) || $cat_count > 0) { + $category_posts["$cat_count->cat_ID"] = $cat_count->cat_count; + } + } + } } if (intval($optiondates) == 1) {