From e05586646a40edc17d6c1fae39167ff236de301c Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Tue, 15 Sep 2015 20:45:32 +0000 Subject: [PATCH] Apply the new `'respond_link'` filter in `comments_popup_link()` if `$number` is `0` before outputting the URL. Props joedolson. Fixes #29454. git-svn-id: https://develop.svn.wordpress.org/trunk@34216 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/comment-template.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/comment-template.php b/src/wp-includes/comment-template.php index 87dc6ce37d..55dc5502af 100644 --- a/src/wp-includes/comment-template.php +++ b/src/wp-includes/comment-template.php @@ -1341,11 +1341,22 @@ function comments_popup_link( $zero = false, $one = false, $more = false, $css_c $home = get_option('siteurl'); echo $home . '/' . $wpcommentspopupfile . '?comments_popup=' . $id; echo '" onclick="wpopen(this.href); return false"'; - } else { // if comments_popup_script() is not in the template, display simple comment link - if ( 0 == $number ) - echo get_permalink() . '#respond'; - else + } else { + // if comments_popup_script() is not in the template, display simple comment link + if ( 0 == $number ) { + $respond_link = get_permalink() . '#respond'; + /** + * Filter the respond link when a post has no comments. + * + * @since 4.4.0 + * + * @param string $respond_link The default response link. + * @param integer $id The post ID. + */ + echo apply_filters( 'respond_link', $respond_link, $id ); + } else { comments_link(); + } echo '"'; }