Make WordPress Core


Ignore:
Timestamp:
06/06/2004 07:21:58 AM (22 years ago)
Author:
rboren
Message:

Guard against empty $cat_counts array. ​http://wordpress.org/support/3/6080

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/template-functions-category.php

    r1385 r1389  
    313313                WHERE post_status = 'publish' $exclusions
    314314                GROUP BY category_id");
    315                 foreach ($cat_counts as $cat_count) {
    316                         if (1 != intval($hide_empty) || $cat_count > 0) {
    317                                 $category_posts["$cat_count->cat_ID"] = $cat_count->cat_count;
    318                         }
    319                 }
     315        if (! empty($cat_counts)) {
     316            foreach ($cat_counts as $cat_count) {
     317                if (1 != intval($hide_empty) || $cat_count > 0) {
     318                    $category_posts["$cat_count->cat_ID"] = $cat_count->cat_count;
     319                }
     320            }
     321        }
    320322        }
    321323       
Note: See TracChangeset for help on using the changeset viewer.