upgrade_250()
Execute changes made in WordPress 2.5.0.
Description Description
Source Source
File: wp-admin/includes/upgrade.php
$wpdb->show_errors();
// Populate comment_count field of posts table.
$comments = $wpdb->get_results( "SELECT comment_post_ID, COUNT(*) as c FROM $wpdb->comments WHERE comment_approved = '1' GROUP BY comment_post_ID" );
if ( is_array( $comments ) ) {
foreach ( $comments as $comment ) {
$wpdb->update( $wpdb->posts, array( 'comment_count' => $comment->c ), array( 'ID' => $comment->comment_post_ID ) );
}
Expand full source code Collapse full source code View on Trac
Changelog Changelog
| Version | Description |
|---|---|
| 2.5.0 | Introduced. |