[wp-trac] [WordPress Trac] #36487: Hierarchical comments do not display on second call of comments_template
WordPress Trac
noreply at wordpress.org
Tue Apr 12 00:56:31 UTC 2016
#36487: Hierarchical comments do not display on second call of comments_template
--------------------------+-----------------------------
Reporter: cookiesowns | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Comments | Version: 4.4.2
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
If you attempt to use comments_template more than once on a page, it will
break rendering of Hierarchical comments on the second or more calls.
It appears to be a bug related to class-wp-comment-
query->get_comment_ids()'s caching.
As get_comment_ids() also populates the clauses such as the where
clauses... for the comment query which fill_descendants() require.
It also spits out SQL errors:
{{{
WordPress database error You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right syntax
to use near 'WHERE AND comment_parent IN (1,4,5) ORDER BY
comment_date_gmt ASC, comment_ID ' at line 1 for query WHERE AND
comment_parent IN (1,4,5) ORDER BY comment_date_gmt ASC, comment_ID ASC
made by require('C:\wamp\www\wordpress-test\wp-blog-header.php'),
require_once('C:\wamp\www\wordpress-test\wp-includes\template-
loader.php'), include('C:\wamp\www\wordpress-test\wp-
content\themes\twentysixteen\single.php'), comments_template,
WP_Comment_Query->__construct, WP_Comment_Query->query,
WP_Comment_Query->get_comments, WP_Comment_Query->fill_descendants
}}}
{{{#!php
<?php
$comment_ids = wp_cache_get( $cache_key, 'comment' );
if ( false === $comment_ids ) {
$comment_ids = $this->get_comment_ids();
wp_cache_add( $cache_key, $comment_ids, 'comment' );
}
}}}
{{{#!php
<?php
protected function fill_descendants( $comments ) {
.....
$_where = $this->filtered_where_clause
....
}
}}}
This is easily reproducible on a clean WP 4.4.2 install. Simply output
comments_template() more than once on a page that has comments in place,
and add some Hierarchical comments.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36487>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list