WordPress.org

Make WordPress Core

Ticket #9670: 9670_checklist.diff

File 9670_checklist.diff, 972 bytes (added by hailin, 9 years ago)

patch

  • C:/xampp/htdocs/wordpress_trunk/wp-admin/includes/template.php

     
    510510
    511511        // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
    512512        $checked_categories = array();
    513         for ( $i = 0; isset($categories[$i]); $i++ ) {
    514                 if ( in_array($categories[$i]->term_id, $args['selected_cats']) ) {
    515                         $checked_categories[] = $categories[$i];
    516                         unset($categories[$i]);
    517                 }
     513        $keys = array_keys( $categories );
     514       
     515        foreach( $keys as $k ) {
     516                if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) {
     517                        $checked_categories[] = $categories[$k];
     518                        unset( $categories[$k] );
     519                }       
    518520        }
    519521
    520522        // Put checked cats on top