fetchRedirect not working on handleError with Polylang translated slugs

Aperta
#693 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
42/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
next.js, typescript, wordpress
Ambito
backend, web-dev

Direzione di ricerca

Inizia da handleError e fetchRedirect, quindi riproduci la configurazione indicata di Polylang e Safe Redirect Manager con slug dei tipi di contenuto tradotti. Confronta il pathname di resolvedUrl in ctx con il percorso con prefisso della locale previsto da WordPress. Il lavoro è completato quando viene rilevato un redirect dal percorso tradotto senza codificare direttamente il pathname.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

next-minor-or-path
Describe the bug

When having the Polylang integration enabled and slugs for post types are translated, the fetchRedirect pathname is not matching the translated slug in handleError, therefore a redirect added for a different locale in WP is not detected.

Steps to Reproduce
  1. Create custom post type., slug example 'programmes'
  2. Add translation to the post type slug in polylang, for example PT 'programas'
  3. Add rewrite in middleware so NextJS knows programas translated path is programmes/
  4. Add a redirect from from WP with Safe Redirect Manager from '/pt/programas/foo' that returns 404 to an existing page
  5. Within handleError function pathname is the ctx resolvedUrl which is programmes/foo
  6. See redirect not working.
  7. Inside handleError to test, hardcode pathname in fetchRedirect to '/pt/programas/foo' and see redirect working.
Screenshots, screen recording, code snippet

No response

Environment information

WP 6.4.3
Safe Redirect Manager 2.1.0
Polylang Pro 3.3.2
@headstartwp/core 1.1.2
@headstartwp/next 1.1.5

WordPress information

No response

Code of Conduct
  • I agree to follow this project's Code of Conduct
Lingua principale
TypeScript
Stelle
204
Fork
26
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di 10up/headstartwp

Tutte le issue di 10up/headstartwp

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.