Make WordPress Core


Ignore:
Timestamp:
09/07/2006 05:42:24 PM (19 years ago)
Author:
ryan
Message:

Avoid infinite loop when category_parent equals cat_ID

File:
1 edited

Legend:

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

    r4104 r4173  
    173173        $path = '/' . $leaf_path;
    174174        $curcategory = $category;
    175         while ($curcategory->category_parent != 0) {
     175        while ( ($curcategory->category_parent != 0) && ($curcategory->category_parent != $curcategory->cat_ID) ) {
    176176            $curcategory = $wpdb->get_row("SELECT cat_ID, category_nicename, category_parent FROM $wpdb->categories WHERE cat_ID = '$curcategory->category_parent'");
    177177            $path = '/' . $curcategory->category_nicename . $path;
     
    220220    $category_list = array();
    221221    foreach ( $categories as $category ) {
     222        if ( $category->cat_ID == $category_id )
     223            continue;
     224
    222225        if ( $category->category_parent == $category_id ) {
    223226            $category_list[] = $category;
Note: See TracChangeset for help on using the changeset viewer.