[wp-trac] [WordPress Trac] #27007: problem using wp_list_comments with 'per_page' without calling comments_template

WordPress Trac noreply at wordpress.org
Sun Feb 9 09:09:23 UTC 2014


#27007: problem using wp_list_comments with 'per_page' without calling
comments_template
--------------------------+------------------
 Reporter:  monotom       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  3.9
Component:  Comments      |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------
Changes (by SergeyBiryukov):

 * keywords:   => has-patch
 * milestone:  Awaiting Review => 3.9


Comment:

 `per_page` is actually not required, I was able to reproduce the issue
 with this example:
 {{{
 wp_list_comments( array(), get_comments() );
 }}}

 Looks like `get_comment_link()` can only generate an invalid link if
 `$in_comment_loop` is true and `cpage` query var is empty:
 [source:tags/3.8.1/src/wp-includes/comment-template.php#L586].

 `$in_comment_loop` is set by `wp_list_comments()`, and `cpage` is normally
 set by `comments_template()`: [source:tags/3.8.1/src/wp-includes/comment-
 template.php#L1078].

 So, if `wp_list_comments()` is called outside of `comments.php` template,
 invalid links are generated. Passing `$args` to `get_comment_link()` in
 `Walker_Comment::html5_comment()`  and `Walker_Comment::comment()` does
 indeed fix the issue.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/27007#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list