WordPress

WordPress 5.5 Sitemap Bug Leading to 404 Errors

A WordPress 5.5 sitemap bug has been identified, affecting some sites that use native WordPress sitemaps. This bug generates non-existent XML sitemap pages, and the issue has been officially confirmed.

Sitemap Pagination Bug

Screenshot of WordPress 5.5 bug report

The WordPress bug impacts websites with sitemaps generated by the WordPress core. It’s particularly problematic for sites with a large number of pages requiring multiple XML sitemaps.

According to the bug report, the sitemaps can appear as follows:

  • wp-sitemap-posts-post-1.xml
  • wp-sitemap-posts-post-2.xml
  • wp-sitemap-posts-post-3.xml

However, when users click on the post-2.xml or post-3.xml links to view these sitemaps, they encounter a 404 error because the sitemaps do not exist.

The bug report notes the following unexpected behavior:

When I visit those URLs, they are:
wp-sitemap-posts-post-1.xml
wp-sitemap-posts-post-2.xml/page/2
wp-sitemap-posts-post-3.xml/page/3

In the example above, clicking on post-2.xml redirects to the non-existent URL, post-2.xml/page/2.

The person reporting the bug also mentioned:

The first URL works correctly, but the last two are 404s.
This happens with no plugins activated and using the twentytwenty theme.
My setup does have “Day and name” permalinks enabled. I’m using PHP 7.3.19 and Nginx 1.19.0 in a local development environment.

Why Did the WordPress Sitemap Bug Happen?

During the WordPress development cycle, early release versions are made available for the community to download and test. Unanticipated bugs, like this one, are discovered during this process. These issues are then noted, assigned a severity level, and scheduled for a patch.

Software bugs can occur due to unexpected events, such as a specific permalink structure triggering the bug.

The WordPress development team documented a patch that introduces a new WordPress function:

Introduces the get_sitemap_url() function which is sort of equivalent to get_permalink() but for sitemaps. That new function is used in redirect_canonical().

The official summary of the fix states:

Sitemaps: Prevent incorrect redirection of paged sitemap requests.
Update redirect_canonical() to account for custom pagination and URL format used by sitemaps in order to follow standard practices.
Introduce the function get_sitemap_url() to simplify getting the index and provider URLs as needed.

A WordPress function is a piece of code that creates a specific functionality, which can be related to themes, plugins, or the WordPress core itself.

The WordPress sitemap is a new feature in the WordPress core, so it is expected that some issues may not have been anticipated.

When Will the WP Sitemap Pagination Bug Be Fixed?

The fix has been completed and is scheduled to be released in WordPress 5.5.1 release candidate 1 on August 27th. The final WordPress 5.5.1 maintenance update is scheduled for Tuesday, September 1, 2020.

Citations

Sitemap Bug Ticket:

  • 5.5 Sitemap URLs Are Incorrectly Paginated

Documentation of Code Being Fixed

WordPress 5.5.1 Maintenance Release Schedule

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button