Changeset 44573 for trunk/src/wp-includes/class-wp-comment-query.php
- Timestamp:
- 01/12/2019 06:05:55 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-comment-query.php
r44546 r44573 556 556 557 557 $orderby_array = array(); 558 $found_orderby_comment_ ID= false;558 $found_orderby_comment_id = false; 559 559 foreach ( $ordersby as $_key => $_value ) { 560 560 if ( ! $_value ) { … … 570 570 } 571 571 572 if ( ! $found_orderby_comment_ ID&& in_array( $_orderby, array( 'comment_ID', 'comment__in' ) ) ) {573 $found_orderby_comment_ ID= true;572 if ( ! $found_orderby_comment_id && in_array( $_orderby, array( 'comment_ID', 'comment__in' ) ) ) { 573 $found_orderby_comment_id = true; 574 574 } 575 575 … … 594 594 595 595 // To ensure determinate sorting, always include a comment_ID clause. 596 if ( ! $found_orderby_comment_ ID) {597 $comment_ ID_order = '';596 if ( ! $found_orderby_comment_id ) { 597 $comment_id_order = ''; 598 598 599 599 // Inherit order from comment_date or comment_date_gmt, if available. 600 600 foreach ( $orderby_array as $orderby_clause ) { 601 601 if ( preg_match( '/comment_date(?:_gmt)*\ (ASC|DESC)/', $orderby_clause, $match ) ) { 602 $comment_ ID_order = $match[1];602 $comment_id_order = $match[1]; 603 603 break; 604 604 } … … 606 606 607 607 // If no date-related order is available, use the date from the first available clause. 608 if ( ! $comment_ ID_order ) {608 if ( ! $comment_id_order ) { 609 609 foreach ( $orderby_array as $orderby_clause ) { 610 610 if ( false !== strpos( 'ASC', $orderby_clause ) ) { 611 $comment_ ID_order = 'ASC';611 $comment_id_order = 'ASC'; 612 612 } else { 613 $comment_ ID_order = 'DESC';613 $comment_id_order = 'DESC'; 614 614 } 615 615 … … 619 619 620 620 // Default to DESC. 621 if ( ! $comment_ ID_order ) {622 $comment_ ID_order = 'DESC';623 } 624 625 $orderby_array[] = "$wpdb->comments.comment_ID $comment_ ID_order";621 if ( ! $comment_id_order ) { 622 $comment_id_order = 'DESC'; 623 } 624 625 $orderby_array[] = "$wpdb->comments.comment_ID $comment_id_order"; 626 626 } 627 627
Note: See TracChangeset
for help on using the changeset viewer.