Avoid undefined index notices. Props SergeyBiryukov, valendesigns. fixes #18455

git-svn-id: https://develop.svn.wordpress.org/trunk@19077 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2011-10-28 19:52:14 +00:00
parent abada6e11d
commit 813f1abd3c
1 changed files with 2 additions and 2 deletions

View File

@ -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;
}