[wp-trac] [WordPress Trac] #35431: Hierarchical comment queries do not work for interrupted hierarchies
WordPress Trac
noreply at wordpress.org
Wed Jan 13 04:09:52 UTC 2016
#35431: Hierarchical comment queries do not work for interrupted hierarchies
--------------------------+-----------------------------
Reporter: boonebgorges | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 4.4
Severity: normal | Keywords: 2nd-opinion
Focuses: |
--------------------------+-----------------------------
Previously: #35192
Since 4.4, `WP_Comment_Query` has supported a hierarchical method of
querying for comments. Notably, the hierarchical strategy is used in the
`comments_template()` chain. This strategy makes comment queries far more
efficient than the previous technique of querying for all of a post's
comments, and then letting `Walker_Comment` handle threading and
pagination. See #8071.
A side effect of the hierarchical query strategy is that the grandchild
`C` of a comment `A` will not be returned if the intermediate comment `B`
is not included in the query results for some reason (say,
`comment__not_in=B`). This is a change in behavior from 4.3 and earlier,
at least in the case of `comments_template()`. (Direct 'hierarchical'
queries were not available before 4.4.)
So the question is: Is this a bug? If I have a comment hierarchy like
this:
{{{
A
|--B
|--C
}}}
and I query comments like this:
{{{
$q = new WP_Comment_Query( array(
'hierarchical' => 'flat',
'comment__not_in' => array( $b ),
) );
}}}
would you expect to get C? Perhaps not by default, but should there be a
way to force interrupted hierarchies to be traversed?
Feedback welcome.
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35431>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list