Skip to content

Conversation

@dinhtungdu
Copy link
Member

@dinhtungdu dinhtungdu commented Dec 9, 2025

Fixes woocommerce/woocommerce#62233

  • WordPress 6.9 adds an AND p.ID fallback in get_adjacent_post(). When two products share the same publish date and the adjacent one is hidden, the query could repeat/hang because the ID wasn’t swapped in that clause. This PR fix this issue by altering the clause with not only date but also the current product ID.

Screenshots

How to test the changes in this Pull Request:

  1. Use Storefront; open a product on the front end (e.g., Polo) and note its next product (e.g., T-Shirt with Logo).
  2. Edit that next product (T-Shirt with Logo): set its publish date/time to exactly match the first product and set visibility to Hidden.
  3. Reload the first product page; confirm it loads without timing out, and the prepared next/prev links do not point to the hidden product.

Changelog

Fix – Adjust the adjacent product query to address the change in WordPress 6.9, so identical publish dates with hidden products no longer cause timeouts - #2202

@dinhtungdu dinhtungdu requested a review from kmanijak December 9, 2025 09:13
Copy link
Contributor

@kmanijak kmanijak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to reproduce the issue and confirm this PR fixes the problem with WP 6.9. Double-checked on WP 6.8 as well (btw great job with the if statement so it's backward compatible).

Also, I think it's fine to do a string replacement rather than regex based replacement given this part is static in the original code (except for comparison operator but you took it into account).

LGTM 👍

@dinhtungdu dinhtungdu requested a review from kmanijak December 9, 2025 10:14
@dinhtungdu dinhtungdu self-assigned this Dec 9, 2025
@dinhtungdu dinhtungdu added type: bug The issue is a confirmed bug. priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. impact: high This issue impacts a lot of users as reported by our Happiness Engineers. labels Dec 9, 2025
@kmanijak kmanijak added the status: ready to merge Automatically applied to a pull when a pull is approved. Indicates ready for merging. label Dec 9, 2025
@dinhtungdu dinhtungdu merged commit dd885e5 into trunk Dec 9, 2025
11 of 12 checks passed
@dinhtungdu dinhtungdu deleted the fix/62233 branch December 9, 2025 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

impact: high This issue impacts a lot of users as reported by our Happiness Engineers. priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. status: ready to merge Automatically applied to a pull when a pull is approved. Indicates ready for merging. type: bug The issue is a confirmed bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: WooCommerce Product Pages Timeout (504) for Certain Categories on Storefront Theme After WordPress 6.9 Update

3 participants