Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure taxonomy non-latin base slugs are cached #7114

Merged
merged 2 commits into from
Nov 19, 2024

Conversation

wordpressfan
Copy link
Contributor

Description

Fixes #7106

This should fix the issue of having non-latin characters in base slugs for any taxonomy, the terms' pages for those taxonomies are not being cached.

Type of change

  • Bug fix (non-breaking change which fixes an issue).

Detailed scenario

  1. Go to WP dashboard >> Settings >> Permalinks
  2. Change the Category base to be продуктова-категория then save permalinks.
  3. Visit any category page in frontend.
  4. The page is not cached before this PR, u can check our HTML comment signature at the end of the page.

Technical description

Documentation

As I mentioned in the issue itself, there is a discussion in the core here:
https://core.trac.wordpress.org/ticket/16839

The main issue here is that When using get_term_link function, it puts the base slug without encoding it at all, but encoding the rest of the url (term slug) so when comparing the current page url with the term url, it fails, so here I decoded both urls before comparing them, and this works perfectly.

New dependencies

No

Risks

I can't think of any risk here, this should work with encoded and non-encoded urls.

Mandatory Checklist

Code validation

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.
  • Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionnable.

Additional Checks

  • In the case of complex code, I wrote comments to explain it.
  • When possible, I prepared ways to observe the implemented system (logs, data, etc.).
  • I added error handling logic when using functions that could throw errors (HTTP/API request, filesystem, etc.)

@wordpressfan wordpressfan self-assigned this Nov 18, 2024
Copy link

codacy-production bot commented Nov 18, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for e5bca661 100.00% (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (e5bca66) Report Missing Report Missing Report Missing
Head commit (a680044) 38172 16713 43.78%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#7114) 1 1 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@wordpressfan wordpressfan marked this pull request as ready for review November 18, 2024 09:44
@wordpressfan wordpressfan requested a review from a team November 18, 2024 09:44
@Mai-Saad
Copy link
Contributor

@wordpressfan Thanks for the PR. working as expected with the following notes:

  • https://wp-media.slack.com/archives/CUT7FLHF1/p1731930778031729?thread_ts=1731891604.218569&cid=CUT7FLHF1
    we have a case that isnot fixed yet (same on 3.17.2.1)
    1- permalinks '/%category%/%postname%/'
    2-visit category page as domain/category/category_page is cached while visiting domain/category_page isnot cached on PR nor 3.17.2 ==> on 3.17.1 even without category in URL, page is cached
  • even on 3.17.2.1 / 3.16.4 , if the admin has an item in the cart then the user cache option is on, visiting category /or product won't be cached till the cart is cleared (in this case , the same cart status appeared to 2 different admins)
    testrail-report-663.pdf

@Mai-Saad Mai-Saad added this pull request to the merge queue Nov 19, 2024
Merged via the queue into develop with commit b29c4e2 Nov 19, 2024
13 checks passed
@Mai-Saad Mai-Saad deleted the fix/7106-non-latin-taxonomy-base-slug-not-cached branch November 19, 2024 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3.17.2 - Product Category not cached for permalink containing letters in non-latin alphabets
4 participants