summaryrefslogtreecommitdiffstats
path: root/wp-includes/category.php
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-12-11 11:45:03 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-12-11 11:45:03 +0000
commit040b8591582940de99442bb1de04afdf9d3daf59 (patch)
treeceaa054562fa6089c307b48fc30e963eee357e73 /wp-includes/category.php
parent91725f574d4fa83b30d8d7c2794e9f078628e6da (diff)
downloadwordpress-mu-040b8591582940de99442bb1de04afdf9d3daf59.tar.gz
wordpress-mu-040b8591582940de99442bb1de04afdf9d3daf59.tar.xz
wordpress-mu-040b8591582940de99442bb1de04afdf9d3daf59.zip
WP Merge to rev 4640
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@823 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/category.php')
-rw-r--r--wp-includes/category.php19
1 files changed, 6 insertions, 13 deletions
diff --git a/wp-includes/category.php b/wp-includes/category.php
index 690c196..56cdbb9 100644
--- a/wp-includes/category.php
+++ b/wp-includes/category.php
@@ -111,15 +111,15 @@ function &get_categories($args = '') {
// Update category counts to include children.
if ( $hierarchical ) {
foreach ( $categories as $k => $category ) {
- $progeny = $category->category_count;
+ $progeny = 'link' == $type ? $category->link_count : $category->category_count;
if ( $children = _get_cat_children($category->cat_ID, $categories) ) {
foreach ( $children as $child )
- $progeny += $child->category_count;
+ $progeny += 'link' == $type ? $child->link_count : $child->category_count;
}
if ( !$progeny && $hide_empty )
unset($categories[$k]);
else
- $categories[$k]->category_count = $progeny;
+ $categories[$k]->{'link' == $type ? 'link_count' : 'category_count'} = $progeny;
}
}
reset ( $categories );
@@ -130,14 +130,6 @@ function &get_categories($args = '') {
return apply_filters('get_categories', $categories, $r);
}
-function delete_get_categories_cache() {
- wp_cache_delete('get_categories', 'category');
-}
-add_action( 'wp_insert_post', 'delete_get_categories_cache' );
-add_action( 'edit_category', 'delete_get_categories_cache' );
-add_action( 'add_category', 'delete_get_categories_cache' );
-add_action( 'delete_category', 'delete_get_categories_cache' );
-
// Retrieves category data given a category ID or category object.
// Handles category caching.
function &get_category(&$category, $output = OBJECT) {
@@ -177,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'");