Changeset 61336
- Timestamp:
- 12/01/2025 03:31:41 PM (12 days ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
src/wp-includes/comment.php (modified) (1 diff)
-
tests/phpunit/tests/comment/wpUpdateCommentCountNow.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/comment.php
r61270 r61336 2873 2873 2874 2874 if ( is_null( $new ) ) { 2875 $new = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1' ", $post_id ) );2875 $new = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1' AND comment_type != 'note'", $post_id ) ); 2876 2876 } else { 2877 2877 $new = (int) $new; -
trunk/tests/phpunit/tests/comment/wpUpdateCommentCountNow.php
r56971 r61336 47 47 } 48 48 49 /** 50 * @ticket 64325 51 */ 52 public function test_only_approved_regular_comments_are_counted() { 53 $post_id = self::factory()->post->create(); 54 55 self::factory()->comment->create( 56 array( 57 'comment_post_ID' => $post_id, 58 'comment_approved' => 0, 59 ) 60 ); 61 self::factory()->comment->create( 62 array( 63 'comment_post_ID' => $post_id, 64 'comment_approved' => 1, 65 ) 66 ); 67 self::factory()->comment->create( 68 array( 69 'comment_post_ID' => $post_id, 70 'comment_type' => 'note', 71 'comment_approved' => 0, 72 ) 73 ); 74 self::factory()->comment->create( 75 array( 76 'comment_post_ID' => $post_id, 77 'comment_type' => 'note', 78 'comment_approved' => 1, 79 ) 80 ); 81 82 $this->assertTrue( wp_update_comment_count_now( $post_id ) ); 83 $this->assertSame( '1', get_comments_number( $post_id ) ); 84 } 85 49 86 public function _return_100() { 50 87 return 100;
Note: See TracChangeset
for help on using the changeset viewer.