mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
Feeds: Remove comment feed HTML headers when empty.
Remove the `link[rel=alternate]` element from the HTML header when the comment feeds are disabled. Previously the HTML element was output with an empty `href` attribute. The element is removed if `get_post_comments_feed_link()` returns an empty string or the feed is disabled via the `feed_links_show_comments_feed` filter. Props barryceelen, audrasjb, costdev, rachelbaker, Boniu91. Fixes #54703. git-svn-id: https://develop.svn.wordpress.org/trunk@53125 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -3153,9 +3153,16 @@ function feed_links_extra( $args = array() ) {
|
||||
$id = 0;
|
||||
$post = get_post( $id );
|
||||
|
||||
if ( comments_open() || pings_open() || $post->comment_count > 0 ) {
|
||||
$title = sprintf( $args['singletitle'], get_bloginfo( 'name' ), $args['separator'], the_title_attribute( array( 'echo' => false ) ) );
|
||||
$href = get_post_comments_feed_link( $post->ID );
|
||||
/** This filter is documented in wp-includes/general-template.php */
|
||||
$show_comments_feed = apply_filters( 'feed_links_show_comments_feed', true );
|
||||
|
||||
if ( $show_comments_feed && ( comments_open() || pings_open() || $post->comment_count > 0 ) ) {
|
||||
$title = sprintf( $args['singletitle'], get_bloginfo( 'name' ), $args['separator'], the_title_attribute( array( 'echo' => false ) ) );
|
||||
$feed_link = get_post_comments_feed_link( $post->ID );
|
||||
|
||||
if ( $feed_link ) {
|
||||
$href = $feed_link;
|
||||
}
|
||||
}
|
||||
} elseif ( is_post_type_archive() ) {
|
||||
$post_type = get_query_var( 'post_type' );
|
||||
|
||||
Reference in New Issue
Block a user