A WordPress 5.5 sitemap bug was reported that affects some sites with native WordPress sitemaps. The bug creates non-existent XML sitemap pages. The issue has been officially confirmed.
Sitemap Pagination Bug
The WordPress bug affects websites sitemaps that are generated by the WordPress core. The bug affects websites that have so many pages that they need more than one XML site map.
According to the bug report, the sitemaps can look like this example:
But when you click on the post-2.xml or post-3.xml link to view those sitemaps, the sitemap does not exist and the server generates a 404 page not found response.
The bug report notes the following unexpected behavior:
“When I visit those URLs, they are:
In the above example, clicking the “…post-2.xml” WordPress redirects the request for that URl to the non-existent URL, “…post-2.xml/page/2”
The person reporting the bug also added:
“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?
As part of the development cycle, WordPress offers early release versions that the WordPress community downloads and tests.
It’s during this process that unanticipated bugs are discovered, noted, and assigned a severity level and a date for a patch to fix the issue.
Software bugs can happen when an unanticipated event, like a specific form of permalink structure, happens which then triggers the unexpected behavior.
The WordPress development team documented this 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 says:
“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. There are functions that are specific to themes, plugins and to the WordPress core.
The WordPress sitemap is a new addition to the WordPress core. So it was almost inevitable for something to have not been anticipated.
When Will WP Sitemap Pagination Bug Be Fixed?
The fix has been completed.
The patch is scheduled to be released in the WordPress 5.5.1 release candidate 1, scheduled for August 27th.
The final WordPress 5.5.1 maintenance update is scheduled for Tuesday September 1, 2020.
Sitemap Bug Ticket:
5.5 Sitemap URLs Are Incorrectly Paginated