Make WordPress Core

Ticket #19893: 19893.diff

File 19893.diff, 654 bytes (added by wonderboymusic, 9 years ago)
  • src/wp-includes/comment-template.php

     
    703703 * @return string The link to the comments.
    704704 */
    705705function get_comments_link( $post_id = 0 ) {
    706         $comments_link = get_permalink( $post_id ) . '#comments';
     706        $post = get_post( $post_id );
     707        if ( ! empty( $post->comment_count ) ) {
     708                $hash = '#comments';
     709        } else {
     710                $hash = '#respond';
     711        }
     712
     713        $comments_link = get_permalink( $post ) . $hash;
    707714        /**
    708715         * Filter the returned post comments permalink.
    709716         *