[wp-trac] [WordPress Trac] #34475: get_comment_link incorrect page number in returned url.
WordPress Trac
noreply at wordpress.org
Thu Oct 29 10:58:43 UTC 2015
#34475: get_comment_link incorrect page number in returned url.
-------------------------------+------------------------------
Reporter: Property118 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Comments | Version: 4.3.1
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses:
-------------------------------+------------------------------
Comment (by Property118):
After a little more investigation, the issue appears to come from the
get_page_of_comment in comment-functions.php.
{{{#!php
<?php
// Find this comment's top level parent if threading is enabled
if ( $args['max_depth'] > 1 && 0 !=
$comment->comment_parent )
return get_page_of_comment(
$comment->comment_parent, $args );
$comment_args = array(
'type' => $args['type'],
'post_id' => $comment->comment_post_ID,
'fields' => 'ids',
'count' => true,
'status' => 'approve',
'parent' => 0,
'date_query' => array(
array(
'column' =>
"$wpdb->comments.comment_date_gmt",
'before' =>
$comment->comment_date_gmt,
)
),
);
}}}
if the parent option in the comment args is not set then the function
{{{#!php
<?php
$comment_query = new WP_Comment_Query();
$older_comment_count = $comment_query->query( $comment_args );
}}}
will actually return the correct page number (in this case 416), as soon
as that option is set then the function ignores any nested comments and
churns out incorrect page numbers.
Thanks
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34475#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list