[wp-trac] [WordPress Trac] #54703: Remove comment feed link if get_post_comments_feed_link() returns empty

WordPress Trac noreply at wordpress.org
Thu Dec 30 22:04:54 UTC 2021


#54703: Remove comment feed link if get_post_comments_feed_link() returns empty
-------------------------------------+-----------------------
 Reporter:  barryceelen              |       Owner:  (none)
     Type:  enhancement              |      Status:  new
 Priority:  normal                   |   Milestone:  6.0
Component:  Feeds                    |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:  template
-------------------------------------+-----------------------

Comment (by costdev):

 > @rachelbaker  It feels off that we would duplicate the
 `feed_links_show_comments_feed` filter but NOT the
 `feed_links_show_posts_feed` filter. For `posts` post_type archives
 wouldn't the same issue be present?

 Yeah this makes sense. If either of those filters returns `false`, the
 feed link shouldn't be output.

 So we'd be looking at something like this then:
 {{{#!php
 <?php

 /** This filter is documented in wp-includes/general-template.php */
 $show_posts_feed = apply_filters( 'feed_links_show_posts_feed', true );

 /** This filter is documented in wp-includes/general-template.php */
 $show_comments_feed = apply_filters( 'feed_links_show_comments_feed', true
 );

 if ( $show_posts_feed && $show_comments_feed && ( comments_open() ||
 pings_open() || $post->comment_count > 0 ) ) {
     //...

 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54703#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list