WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/12/2015 07:35:05 AM (6 years ago)
Author:
wonderboymusic
Message:

Comments: get_comments_link() should return a link with #respond as the hash instead of #comments if get_comments_number() returns 0.

Props cgrymala, wonderboymusic.
Fixes #19893.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment-template.php

    r34069 r34075  
    704704 */
    705705function get_comments_link( $post_id = 0 ) {
    706     $comments_link = get_permalink( $post_id ) . '#comments';
     706    $hash = get_comments_number( $post_id ) ? '#comments' : '#respond';
     707    $comments_link = get_permalink( $post_id ) . $hash;
    707708    /**
    708709     * Filter the returned post comments permalink.
Note: See TracChangeset for help on using the changeset viewer.