Make WordPress Core

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#28508 closed defect (bug) (duplicate)

Turning on RSS feed should not return 404 page not found if no posts

Reported by: bretterer's profile bretterer Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.9.1
Component: Feeds Keywords:
Focuses: Cc:

Description

When starting a new blog, It is common for me to delete all sample post data. When visiting the feed after doing this, I get a page not found error. I understand this is related to a few closed bugs but feel that this bug is necessary to fix. When you have no posts, I think it should return something that describes the site but just has empty item list. Doing so would make it so the feed would be a valid feed.

Change History (6)

#1 @Eric3D
11 years ago

This behavior should also apply to comment feeds (i.e., for a site where there are posts but comments are blocked).

#2 follow-up: @SergeyBiryukov
11 years ago

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

When you have no posts, I think it should return something that describes the site but just has empty item list. Doing so would make it so the feed would be a valid feed.

I do get a valid empty feed after removing the sample post on a clean install:

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WordPress 3.8.1 &#187; Page not found</title>
	<atom:link href="http://releases.wordpress/3.8.1/feed/" rel="self" type="application/rss+xml" />
	<link>http://releases.wordpress/3.8.1</link>
	<description>Ещё один сайт на WordPress</description>
	<lastBuildDate>Tue, 01 Apr 2014 10:34:10 +0000</lastBuildDate>
	<language>ru-RU</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.8.1</generator>
</channel>
</rss>

However, the HTTP status code is 404. Closing as a duplicate of #18505 and #27146.

#3 in reply to: ↑ 2 ; follow-up: @bretterer
11 years ago

  • Resolution duplicate deleted
  • Status changed from closed to reopened

It does not test as valid xml when you run it though http://feedvalidator.org/ or any other rss feed validator...

Replying to SergeyBiryukov:

When you have no posts, I think it should return something that describes the site but just has empty item list. Doing so would make it so the feed would be a valid feed.

I do get a valid empty feed after removing the sample post on a clean install:

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>WordPress 3.8.1 &#187; Page not found</title>
	<atom:link href="http://releases.wordpress/3.8.1/feed/" rel="self" type="application/rss+xml" />
	<link>http://releases.wordpress/3.8.1</link>
	<description>Ещё один сайт на WordPress</description>
	<lastBuildDate>Tue, 01 Apr 2014 10:34:10 +0000</lastBuildDate>
	<language>ru-RU</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.8.1</generator>
</channel>
</rss>

However, the HTTP status code is 404. Closing as a duplicate of #18505 and #27146.

#4 in reply to: ↑ 3 @SergeyBiryukov
11 years ago

  • Resolution set to duplicate
  • Status changed from reopened to closed

Replying to bretterer:

It does not test as valid xml when you run it though http://feedvalidator.org/ or any other rss feed validator...

Yes, because of the HTTP status code:

This feed does not validate.

Server returned HTTP Error 404: Not Found
HTTP error with content that looks like a feed

#18505 would fix this.

#5 @Eric3D
11 years ago

I confirm that the #18505 patch works.

Since the file changed significantly since the patch was written, the place to add is_feed() in WP 3.9.1 is line 563 in class-wp.php:

		// Never 404 for the admin, robots, or if we found posts.
		if ( is_admin() || is_robots() || $wp_query->posts || is_feed() ) {
			status_header( 200 );
			return;
		}

Any reason why this hasn't made it to the core after 3 years?

#6 @SergeyBiryukov
11 years ago

I've refreshed the patch on #18505, let's continue the discussion there.

Note: See TracTickets for help on using tickets.