mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-23 07:51:49 +01:00
Comments: Account for the comment_order
option in get_page_of_comment()
.
Use the value of the `comment_order` setting to determine the date_query key to pass to `WP_Comment_Query`. Fixes a bug where sites that had comments ordered "newest" first would have the incorrect page number returned. Props tyxla, boonebgorges. Fixes #31101. Built from https://develop.svn.wordpress.org/trunk@38740 git-svn-id: http://core.svn.wordpress.org/trunk@38683 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e4bfe48ebc
commit
4ca1385b60
@ -918,6 +918,12 @@ function get_page_of_comment( $comment_ID, $args = array() ) {
|
|||||||
if ( $args['max_depth'] > 1 && 0 != $comment->comment_parent )
|
if ( $args['max_depth'] > 1 && 0 != $comment->comment_parent )
|
||||||
return get_page_of_comment( $comment->comment_parent, $args );
|
return get_page_of_comment( $comment->comment_parent, $args );
|
||||||
|
|
||||||
|
if ( 'desc' === get_option( 'comment_order' ) ) {
|
||||||
|
$compare = 'after';
|
||||||
|
} else {
|
||||||
|
$compare = 'before';
|
||||||
|
}
|
||||||
|
|
||||||
$comment_args = array(
|
$comment_args = array(
|
||||||
'type' => $args['type'],
|
'type' => $args['type'],
|
||||||
'post_id' => $comment->comment_post_ID,
|
'post_id' => $comment->comment_post_ID,
|
||||||
@ -928,7 +934,7 @@ function get_page_of_comment( $comment_ID, $args = array() ) {
|
|||||||
'date_query' => array(
|
'date_query' => array(
|
||||||
array(
|
array(
|
||||||
'column' => "$wpdb->comments.comment_date_gmt",
|
'column' => "$wpdb->comments.comment_date_gmt",
|
||||||
'before' => $comment->comment_date_gmt,
|
$compare => $comment->comment_date_gmt,
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.7-alpha-38739';
|
$wp_version = '4.7-alpha-38740';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user