#24801 closed defect (bug) (worksforme)
comments_number() shows "0 Comments" after Theme Unit Test import
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.5.2 |
Component: | Comments | Keywords: | close 2nd-opinion |
Focuses: | Cc: |
Description
After importing the Theme Unit Test file in WP 3.5.2 and 3.6 RC, and viewing a post with comments attached to, comments_number() shows "0 Comments". However after writing a new comment, it updates and shows the correct number.
I've tested this in 3.5.2's Twenty Twelve and 3.6's Twenty Thirteen, the result is the same. In the Admin Comments page, the number in the bubble, under the post name that the comment is attached to, shows zero. Again this is before the "refresh with new comment" method.
Change History (3)
#2
@
10 years ago
- Milestone Awaiting Review deleted
- Resolution set to worksforme
- Status changed from new to closed
I am unable to reproduce this issue either. I was also unable to find a ticket that would have fixed the reported issue.
#3
@
8 years ago
I experienced the same issue on page comments after importing the WP test data. This seems to do the trick:
<?php add_filter('get_comments_number', 'comment_count', 0); function comment_count( $count ) { if ( ! is_admin() ) { global $id; $comments_by_type = &separate_comments(get_comments('status=approve&post_id=' . $id)); return count($comments_by_type['comment']); } else { return $count; } }
Note: See
TracTickets for help on using
tickets.
Cannot reproduce on r26746. Fresh installation, imported the XML file downloaded from the Codex (https://wpcom-themes.svn.automattic.com/demo/theme-unit-test-data.xml). Shows comment number fine in multiple places within the admin: