WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/06/2016 05:41:51 PM (4 years ago)
Author:
rachelbaker
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment.php

    r38738 r38740  
    919919            return get_page_of_comment( $comment->comment_parent, $args );
    920920
     921        if ( 'desc' === get_option( 'comment_order' ) ) {
     922            $compare = 'after';
     923        } else {
     924            $compare = 'before';
     925        }
     926
    921927        $comment_args = array(
    922928            'type'       => $args['type'],
     
    929935                array(
    930936                    'column' => "$wpdb->comments.comment_date_gmt",
    931                     'before' => $comment->comment_date_gmt,
     937                    $compare => $comment->comment_date_gmt,
    932938                )
    933939            ),
Note: See TracChangeset for help on using the changeset viewer.