[wp-trac] [WordPress Trac] #34073: Comment walker calls get_comment_link with invalid arguments

WordPress Trac noreply at wordpress.org
Thu Oct 1 05:12:40 UTC 2015


#34073: Comment walker calls get_comment_link with invalid arguments
-------------------------------------+---------------------------
 Reporter:  peterwilsoncc            |       Owner:  boonebgorges
     Type:  defect (bug)             |      Status:  closed
 Priority:  normal                   |   Milestone:  4.4
Component:  Comments                 |     Version:  trunk
 Severity:  normal                   |  Resolution:  fixed
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+---------------------------
Changes (by boonebgorges):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"34735"]:
 {{{
 #!CommitTicketReference repository="" revision="34735"
 Ensure that comment permalinks reflect pagination.

 After [34561], `wp_list_comments()` no longer passed all of a post's
 comments
 to `Walker_Comments`. As a result, calls to `get_comment_link()` occurring
 inside the comment loop had insufficient context to determine the proper
 'cpage' value to use when generating comment permalinks. This, in turn,
 caused
 comment permalinks to behave erratically.

 The current changeset addresses the problem as follows:

 * `get_comment_link()` now accepts a 'cpage' parameter. When present,
 'cpage' will be used to build the comment permalink - no automatic
 calculation will take place.
 * When called within the main loop, `wp_list_comments()` calculates the
 proper 'cpage' value for comments in the loop, and passes it down to
 `get_comment_link()`.
 * `cpage` and `comment-page-x` query vars are generally required in
 comment permalinks (see #34068), but an exception is made when
 'default_comment_page=oldest': the bare post permalink will always be the
 same as `cpage=1`, so `cpage` is excluded in this case.

 Props peterwilsoncc for assiduous spreadsheeting.
 Fixes #34073.
 }}}

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


More information about the wp-trac mailing list