[wp-trac] [WordPress Trac] #14809: comments_by_type doesn't always get reset
WordPress Trac
wp-trac at lists.automattic.com
Wed Sep 8 01:18:20 UTC 2010
#14809: comments_by_type doesn't always get reset
--------------------------+-------------------------------------------------
Reporter: nmassey | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Comments | Version: 3.0.1
Severity: minor | Keywords:
--------------------------+-------------------------------------------------
in wp-includes/comment-template.php , in function comments_template(), it
is possible for $wp_query->comments to be set but for
$wp_query->comments_by_type NOT to get reset when it should be reset to
array(). We ran into a bug because:[[BR]]
- on a single page (actually inside of a widget), we were pulling comments
from multiple posts[[BR]]
- for each post, we were requesting get_comments(array('type' =>
'comment'))[[BR]]
- in wp-includes/comment-template.php , in function wp_list_comments(),
code says:
{{{
if ( 'all' != $r['type'] ) {
if ( empty($wp_query->comments_by_type) )
$wp_query->comments_by_type =
&separate_comments($wp_query->comments);
if (
empty($wp_query->comments_by_type[$r['type']]) )
return;
$_comments =
$wp_query->comments_by_type[$r['type']];
}}}
unfortunately, since we were running that again and again, it would not
recalculate $wp_query->comments_by_type each time.
I think that the function comments_template() in wp-includes/comment-
template.php should have the following line added:
{{{
$wp_query->comments_by_type = array();
}}}
right after the line where $wp_query->comments is set.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/14809>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list