[wp-trac] [WordPress Trac] #34475: get_comment_link incorrect page number in returned url.

WordPress Trac noreply at wordpress.org
Wed Oct 28 17:06:41 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):

 Replying to [comment:3 boonebgorges]:
 > Thanks for the details. Comments appearing on
 http://www.property118.com/budget-2015-landlords-reactions/76164/comment-
 page-154 *do* appear to have their comment permalinks (the timestamps)
 pointing to the correct page. Where are the incorrect comment links being
 generated? In the sidebar widget? Are you calling `get_comment_link()`
 somewhere in a custom template?

 Hi boonebgorges,

 I am testing at the moment using custom code as below:

 {{{#!php
 <?php
 function commenttest(){
         $comments = get_comments('status=approve&number=5');
         $output = '<ul style="font-size:5px">';
     foreach ($comments as $comment) {

         $output .= '<li style="font-size:10px;">
                                 <div style="float:left;margin-
 right:3px">';
                                     $output .= get_avatar( $comment, '35'
 );
                                     $output .= '</div>
                                     $output .= $comment->comment_content;
                                     $output .= wp_html_excerpt(
 $comment->comment_content, 35 );
                                     $link =
 get_comment_link($comment->comment_ID, array('per_page'=>10));
                                     $output .= '...<br/>
 LINK: '.$link.'
                                     <div style="clear:both;"></div>
         </li>';
      }
         $output .= '</ul>';
         echo $output;
 }
 }}}


 As you can see i am making this function give both a created link and the
 get_comment_link

 However the call to the get_comments_link is the same on the comment
 notifier plugin (and both the comment notifier plugin and this function
 give exactly the same results).

 Comment Notifier Plugin hasnt been updated in two years by the dev but i
 have checked through all the code and it is retrieving the correct comment
 ids which are being passed to get_comment_link then giving the incorrect
 page number in the output url.

 Thanks

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


More information about the wp-trac mailing list