From 2c31712d3abcd1c2b733622846b690d5f5df7efa Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 4 Apr 2007 22:32:24 +0000 Subject: [PATCH] Category listing speedups. see #3985 git-svn-id: http://svn.automattic.com/wordpress/trunk@5179 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/category.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wp-includes/category.php b/wp-includes/category.php index 25051b0a6..f8b61b96f 100644 --- a/wp-includes/category.php +++ b/wp-includes/category.php @@ -264,12 +264,17 @@ function &_get_cat_children($category_id, $categories) { $category_list = array(); $children = _get_category_hierarchy(); + + if ( ( 0 != $category_id ) && ! isset($children[$category_id]) ) + return array(); + foreach ( $categories as $category ) { if ( $category->cat_ID == $category_id ) continue; if ( $category->category_parent == $category_id ) { $category_list[] = $category; + if ( !isset($children[$category->cat_ID]) ) continue;