WordPress.org

Make WordPress Core

Ticket #34475: 34475.1.patch

File 34475.1.patch, 1.3 KB (added by Mista-Flo, 3 years ago)

Fix parent arg strange behavior with comments pagination

  • wp-includes/comment.php

    From ef6f1354e9e83f584d22782a77ab46ed6bec099c Mon Sep 17 00:00:00 2001
    From: Florian TIAR <contact@tiar-florian.fr>
    Date: Tue, 27 Sep 2016 10:41:41 +0200
    Subject: [PATCH] Comments : Fix incorect page number for comments due to parent arg
    
    ---
     wp-includes/comment.php | 9 ++++++---
     1 file changed, 6 insertions(+), 3 deletions(-)
    
    diff --git a/wp-includes/comment.php b/wp-includes/comment.php
    index 27524c5..a0d6e3c 100644
    a b function get_page_of_comment( $comment_ID, $args = array() ) { 
    902902        }
    903903
    904904        if ( null === $page ) {
     905                $parent = 0;
    905906                if ( '' === $args['max_depth'] ) {
    906                         if ( get_option('thread_comments') )
     907                        if ( get_option('thread_comments') ) {
    907908                                $args['max_depth'] = get_option('thread_comments_depth');
    908                         else
     909                        } else {
    909910                                $args['max_depth'] = -1;
     911                                $parent = '';
     912                        }
    910913                }
    911914
    912915                // Find this comment's top level parent if threading is enabled
    function get_page_of_comment( $comment_ID, $args = array() ) { 
    919922                        'fields'     => 'ids',
    920923                        'count'      => true,
    921924                        'status'     => 'approve',
    922                         'parent'     => 0,
     925                        'parent'     => $parent,
    923926                        'date_query' => array(
    924927                                array(
    925928                                        'column' => "$wpdb->comments.comment_date_gmt",