Comments: in WP_Comment::get_children(), accept an array so that the values for format, status, hierarchical, and orderby can be passed, instead of just format. The defaults for get_comments() include status = 'all' and orderby = '' - which is no bueno.

For threaded comments, we need comments to be retrieved within bounds, so logged-out users don't see unmoderated comments on the front end, etc.

Updates unit tests.

See #8071.


git-svn-id: https://develop.svn.wordpress.org/trunk@34569 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2015-09-26 02:24:17 +00:00
parent bc451880e5
commit e09edc2d7f
3 changed files with 124 additions and 15 deletions

View File

@@ -1307,7 +1307,11 @@ function comments_template( $file = '/comments.php', $separate_comments = false
// Trees must be flattened before they're passed to the walker.
$comments_flat = array();
foreach ( $_comments as $_comment ) {
$comments_flat = array_merge( $comments_flat, array( $_comment ), $_comment->get_children( 'flat' ) );
$comments_flat = array_merge( $comments_flat, array( $_comment ), $_comment->get_children( array(
'format' => 'flat',
'status' => $comment_args['status'],
'orderby' => $comment_args['orderby']
) ) );
}
/**