From 813f1abd3ca4b26e23c9b7f983e570755d8cc6c2 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Fri, 28 Oct 2011 19:52:14 +0000 Subject: [PATCH] Avoid undefined index notices. Props SergeyBiryukov, valendesigns. fixes #18455 git-svn-id: https://develop.svn.wordpress.org/trunk@19077 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/taxonomy.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index 4ee97589ce..4d525d69c0 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -2816,8 +2816,8 @@ function _pad_term_counts(&$terms, $taxonomy) { // Touch every ancestor's lookup row for each post in each term foreach ( $term_ids as $term_id ) { $child = $term_id; - while ( $parent = $terms_by_id[$child]->parent ) { - if ( !empty($term_items[$term_id]) ) + while ( !empty( $terms_by_id[$child] ) && $parent = $terms_by_id[$child]->parent ) { + if ( !empty( $term_items[$term_id] ) ) foreach ( $term_items[$term_id] as $item_id => $touches ) { $term_items[$parent][$item_id] = isset($term_items[$parent][$item_id]) ? ++$term_items[$parent][$item_id]: 1; }