WordPress.org

Make WordPress Core

Ticket #19893: comment-template.php.no-responses.get_comments_link.patch

File comment-template.php.no-responses.get_comments_link.patch, 479 bytes (added by cgrymala, 4 years ago)

get_comments_link() checks number of comments before generating link

  • comment-template.php

     
    516516 * @return string The link to the comments 
    517517 */ 
    518518function get_comments_link($post_id = 0) { 
    519         return get_permalink($post_id) . '#comments'; 
     519        return 0 == get_comments_num( $post_id ) ? get_permalink( $post_id ) . '#respond' : get_permalink($post_id) . '#comments'; 
    520520} 
    521521 
    522522/**