1

I am facing a puzzling issue with permalinks on a WordPress site that has been running on the same host for several years. A recent upgrade of WordPress, its plugins, or the shared hosting infrastructure might have caused this, but since it is not exactly known when it started, it's difficult to pinpoint the exact cause.

Symptoms: as soon as a new post is published, everything works OK for all the posts. About 15 minutes later, the most recent post (based on date, not ID) will stop working - navigating to its permalink will result in the usual WP 404 page. Editing the post will make it work again - for 15 minutes. Changing permalink settings will make it work - for 15 minutes. It is always the most recent post that gets broken.

What I've tried: besides what's described above, tested multiple browsers, connections, HTTP 1.1 vs. 2.0, tested disabling caching (xcache/opcache) in the hosting control panel, upgraded WordPress from 5.8.x to the latest 6.1.x, to no avail. There are no errors logged to any of the logs when this happens.

Setup: WordPress 6.1.1-sk_SK, theme: Twenty Eleven 4.2 with a custom child theme, a number of plugins, running on PHP 7.4 with MySQL 5.7.

The .htaccess file currently has the mod_rewrite rules for the Really Simple SSL plugin and the generic BEGIN WordPress/END WordPress block plus php_value opcache.enable 0 line.

I'm suspecting it could be somehow linked to the fairly old TwentyEleven theme? Or something completely different? I'm running out of ideas on what to try - any suggestions will be more than welcome!

Update: after testing on a site mirror, it looks like it might be the child theme, which was created for Twenty Eleven 1.7 and last updated for version 2.8, but Twenty Eleven is now at version 4.2. The wait period makes this difficult to test so I'm still not 100% sure but this seems likely.

Update 2: in the end, it was not the child theme, but the Google XML Sitemap plugin at version 4.1.5. Disabling the plugin or upgrading to 4.1.7 fixed the issue - so far, at least. I'll keep watching the site before marking this resolved.

4
  • Nice job tracking this down, but I'm still at a loss to explain it. Any idea what the child theme is doing to break this?
    – Rup
    Jan 4, 2023 at 12:51
  • I'd guess the rewrite_rules value in wp_options is being overwritten and reset by some job, or it was never persisted there in the first place and e.g. written to a memcached or something instead, that's getting reset or discarded after 15 mins.
    – Rup
    Jan 4, 2023 at 12:54
  • Does the ?p= link for the new page still work?
    – Rup
    Jan 4, 2023 at 12:56
  • 1
    @Rup when I use a ?p= link it would redirect to the post's permalink and that would fail. I didn't try switching to the ?p= format permanently. However, it turns out it is not the child theme in the end, but one of the plugins, I will post more as soon as I'm able to confirm.
    – Rado
    Jan 4, 2023 at 16:34

1 Answer 1

1

In our case, the issue was caused by a specific plugin, in this case it was the Google XML Sitemaps version 4.1.5, upgrading to 4.1.7 resolved the problem.

A bit of background: this non-profit site is highly seasonal and we usually upgrade and test everything before the 2-month peak season starts, and try to avoid plugin upgrades during this period as it's challenging enough to deal with content. Once again it proved to be very useful to have a site mirror for testing and troubleshooting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.