From 41c5bfb49322078c900282d98101584d49ebe792 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sat, 12 Sep 2015 07:36:25 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@34075 git-svn-id: http://core.svn.wordpress.org/trunk@34043 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment-template.php | 3 ++- wp-includes/version.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index 9d63bd3af9..87dc6ce37d 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -703,7 +703,8 @@ function get_comment_link( $comment = null, $args = array() ) { * @return string The link to the comments. */ function get_comments_link( $post_id = 0 ) { - $comments_link = get_permalink( $post_id ) . '#comments'; + $hash = get_comments_number( $post_id ) ? '#comments' : '#respond'; + $comments_link = get_permalink( $post_id ) . $hash; /** * Filter the returned post comments permalink. * diff --git a/wp-includes/version.php b/wp-includes/version.php index 51891d2f69..21267c5d53 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34074'; +$wp_version = '4.4-alpha-34075'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.