Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 10 years ago

#21983 closed defect (bug) (invalid)

Sitemap xml feed from plugin is shown but 404 header added by WordPress if site has no posts

Reported by: ov3rfly's profile Ov3rfly Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.4.2
Component: General Keywords:
Focuses: Cc:

Description

Installed a new site with only pages, no posts.

Also installed the WordPress Sitemap Generator Plugin with a modified template for the pages.

Testing example.com/sitemap.xml in browser showed the xml with all the pages, all seemed fine.

But then Google Webmaster Tools complained about a 404 not found for the /sitemap.xml url.

Some testing showed that WordPress adds a 404 header to all feeds, including the sitemap xml feed, if no posts exist in the website.

Using a work-aound for now, details here, but would like to know this behaviour is to be considered as a bug.

Change History (2)

#1 @markoheijnen
12 years ago

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

The error is correct and the plugin doesn't deal with all cases. The reason is that the main query still tries to get all the posts and when there aren't one it will show a 404.

I guess it is better to use something like http://wordpress.org/extend/plugins/google-sitemap-generator/ and then the beta.

#2 @Ov3rfly
10 years ago

Finally fixed with [29216]

Same as #18505

Note: See TracTickets for help on using tickets.