WordPress 5.5 Sitemap Bug Discovered Which Causes 404 Errors

August 31, 2020
WordPress-5.5-Sitemap-Bug-Discovered-Which-Causes-404-Errors

WordPress 5.5 Sitemap Bug Discovered Which Causes 404 Errors

A WordPress 5.5 sitemap bug was reported that influences some websites with native WordPress sitemaps. The bug makes non-existent XML sitemap pages. The issue has been officially confirmed.

Sitemap Pagination Bug

wordpress-bug-screenshot

The WordPress bug influences websites sitemaps that are created by the WordPress core. The bug influences sites that have so many pages that they need more than one XML site map.

As indicated by the bug report, the sitemaps can resemble this example:

“wp-sitemap-posts-post-1.xml

wp-sitemap-posts-post-2.xml

wp-sitemap-posts-post-3.xml”

But, when you click on the post-2.xml or post 3.xml link to view those sitemaps, the sitemap doesn’t 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:

wp-sitemap-posts-post-1.xml

wp-sitemap-posts-post-2.xml/page/2

wp-sitemap-posts-post-3.xml/page/3”

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 included:

“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 a major aspect of the development cycle, WordPress offers early release versions that the WordPress community downloads and tests.

It’s during this process unexpected bugs are found, noted, and assigned a seriousness level and a date for a patch to fix the issue.

Programming bugs can happen when an unanticipated event, similar to a particular type of permalink structure, happens which then triggers the unexpected behavior.

The WordPress development team documented this fix 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 makes a particular functionality. There are functions that are explicit to themes, plugins and to the WordPress core.

The WordPress sitemap is new addition to the WordPress core. So it was practically inescapable for something to have not been anticipated.

When Will WP Sitemap Pagination Bug Be Fixed?

The fix has been finished.

The fix is scheduled to be released in the WordPress 5.5.1 release candidate 1, planned for August 27th.

The last WordPress 5.5.1 maintenance update is scheduled for Tuesday September 1, 2020.

We at CodeLedge, offer Sweden’s best WordPress Development and customization services. If you are having any trouble with selecting your best possible website design, feel free to contact us at hi@codeledge.net or get a quote from here.

Leave a Reply

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

Translate »