mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 12:50:28 +00:00
Cache category hierarchy to make cat listing faster. Phase 1. see #3985
git-svn-id: https://develop.svn.wordpress.org/trunk@5178 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -791,12 +791,15 @@ function cat_rows( $parent = 0, $level = 0, $categories = 0 ) {
|
||||
if (!$categories )
|
||||
$categories = get_categories( 'hide_empty=0' );
|
||||
|
||||
$children = _get_category_hierarchy();
|
||||
|
||||
if ( $categories ) {
|
||||
ob_start();
|
||||
foreach ( $categories as $category ) {
|
||||
if ( $category->category_parent == $parent) {
|
||||
echo "\t" . _cat_row( $category, $level );
|
||||
cat_rows( $category->cat_ID, $level +1, $categories );
|
||||
if ( isset($children[$category->cat_ID]) )
|
||||
cat_rows( $category->cat_ID, $level +1, $categories );
|
||||
}
|
||||
}
|
||||
$output = ob_get_contents();
|
||||
|
||||
Reference in New Issue
Block a user