Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#17823 closed feature request (invalid)

feed_links() ask for comments_open()

Reported by: Bueltge Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.2
Component: Feeds Keywords: dev-feedback
Focuses: Cc:


Current will WordPress also include the comment-feed with hook wp_head and function feed_links. Maybe a small changes on this function make it usefull for use WordPress without comments on themes.

function feed_links( $args = array() ) {
	if ( !current_theme_supports('automatic-feed-links') )

	$defaults = array(
		/* translators: Separator between blog name and feed type in feed links */
		'separator'	=> _x('»', 'feed link'),
		/* translators: 1: blog title, 2: separator (raquo) */
		'feedtitle'	=> __('%1$s %2$s Feed'),
		/* translators: %s: blog title, 2: separator (raquo) */
		'comstitle'	=> __('%1$s %2$s Comments Feed'),
	if ( (get_option('default_comment_status') != 'open') )
		unset( $defaults['comstitle'] );
	$args = wp_parse_args( $args, $defaults );

	echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr(sprintf( $args['feedtitle'], get_bloginfo('name'), $args['separator'] )) . '" href="' . get_feed_link() . "\" />\n";
	if ( (get_option('default_comment_status') == 'open') )
		echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr(sprintf( $args['comstitle'], get_bloginfo('name'), $args['separator'] )) . '" href="' . get_feed_link( 'comments_' . get_default_feed() ) . "\" />\n";

Attachments (1)

patch.txt (1.5 KB) - added by Bueltge 7 years ago.
patch for see the difference

Download all attachments as: .zip

Change History (10)

7 years ago

patch for see the difference

#1 @kawauso
7 years ago

The 'default_comment_status' option reflects the default status for comments on new posts/pages, not necessarily the status of existing content.

Theme authors can easily unhook the 'feed_links' action if so desired.

#2 @Bueltge
7 years ago

maybe we can add comments_open() to the default_comment_stutus. Current it give many sites with a comment feed and no active comment-function on the theme and many theme outhors dont change this. Yes she can remove the function, but she must also add the other feeds or add custom function for feed_links.

#3 @kawauso
7 years ago

comments_open() is for the current post/page though, whereas the comments feed given is for the entire blog.

#4 @Bueltge
7 years ago

yes, but we can check for an post/page, if has open comments. If is not a post_type with open comments, than is the feed useless.

#5 @kawauso
7 years ago

The current post/page status isn't representative of the entire blog or the post type overall.

#6 @Bueltge
7 years ago

yes, i understand this; but we can check about all post_types for open comment; not realy the patch - right, but possible and more effizient for the users.

#7 @kawauso
7 years ago

That would require post types to have had comments disabled by the theme, unless you're suggesting checking all posts in the database?

I don't see how that's in any way more efficient than the theme author changing behaviour as desired, especially since there's already support for that.

Last edited 7 years ago by kawauso (previous) (diff)

#8 @Bueltge
7 years ago

yes, this its the way. I think, it is not konsist - the feed_links check not for comments, feed_links_extra() to do this. Yes, the functions have different tasks, but the return is only important, it give it data.

#9 @nacin
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Beyond intensive queries (and even then), there's no way to determine when a site doesn't support comments.

Solution: don't use automatic feed links.

Note: See TracTickets for help on using tickets.