Make WordPress Core

Changeset 2977


Ignore:
Timestamp:
10/29/2005 11:28:05 PM (19 years ago)
Author:
matt
Message:

Even better, array functions are fun.

File:
1 edited

Legend:

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

    r2976 r2977  
    12941294        foreach ($comment_counts as $comment_count) {
    12951295            $comment_count_cache["$comment_count->comment_post_ID"] = $comment_count->ccount;
    1296             $got_count[] = $comment_count->comment_post_ID;
    1297         }
    1298         foreach ( $post_id_array as $id )
    1299             if ( !in_array( $id, $got_count ) )
    1300                 $comment_count_cache["$id"] = 0;
     1296            $has_comments[] = $comment_count->comment_post_ID;
     1297        }
     1298        $no_comments = array_diff( $post_id_array, $has_comments );
     1299        foreach ( $no_comments as $id )
     1300            $comment_count_cache["$id"] = 0;
    13011301    }
    13021302
Note: See TracChangeset for help on using the changeset viewer.