Make WordPress Core

Ticket #20903: 20903.2.diff

File 20903.2.diff, 814 bytes (added by westi, 13 years ago)

Improved patch - term_exists only tests true ints as term_ids :(

  • wp-admin/includes/export.php

     
    9494
    9595                // put categories in order with no child going before its parent
    9696                while ( $cat = array_shift( $categories ) ) {
    97                         if ( $cat->parent == 0 || isset( $cats[$cat->parent] ) )
     97                        if ( $cat->parent == 0 || isset( $cats[$cat->parent] ) ) {
    9898                                $cats[$cat->term_id] = $cat;
    99                         else
     99                        } elseif ( term_exists( (int) $cat->parent, 'category' ) ) {
     100                                // Assume we will find the parent later
    100101                                $categories[] = $cat;
     102                        } else {
     103                                // For some reason the parent is missing
     104                                $cats[$cat->term_id] = $cat;
     105                        }
    101106                }
    102107
    103108                // put terms in order with no child going before its parent