wp-rocket icon indicating copy to clipboard operation
wp-rocket copied to clipboard

Product Category Cache isn't cleared for permalink containing letters in non-latin alphabets

Open johan-las opened this issue 1 year ago • 0 comments

Describe the bug

On product update, the Product Category Cache isn't cleared for permalink containing letters in non-latin alphabets. The issue is with get_term_link() function which is adding the Category Base /product-category/ without encoding the URL for non-latin alphabets characters.

Example of the URL returned by get_term_link() :

https://www.domain.com/продуктова-категория/%d0%bf%d1%8a%d1%82%d0%b5%d0%ba%d0%b8/%d0%bc%d0%be%d0%b4%d0%b5%d1%80%d0%bd%d0%b8-%d0%bf%d1%8a%d1%82%d0%b5%d0%ba%d0%b8/

We can see that the Category base is not encoded.

To Reproduce

Steps to reproduce the behavior:

  1. Go on a WordPress with Woocommerce and Cyrillic URLs
  2. The Product Category URL should have the default Category Base.
  3. Update a Product.
  4. The product cache is updated, not the category cache.

Expected behavior

The Product Category Cache should be cleared on product update.

Additional context

Slack discussion: https://wp-media.slack.com/archives/C43T1AYMQ/p1728657382279759 Related ticket: https://secure.helpscout.net/conversation/2724795871/515791?folderId=8127840

johan-las avatar Oct 16 '24 07:10 johan-las