fetchRedirect not working on handleError with Polylang translated slugs

Đang mở
#693 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
42/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
next.js, typescript, wordpress
Lĩnh vực
backend, web-dev

Hướng nghiên cứu

Bắt đầu từ handleError và fetchRedirect, sau đó tái hiện thiết lập Polylang và Safe Redirect Manager được liệt kê với các slug của post type đã dịch. So sánh pathname của resolvedUrl trong ctx với đường dẫn có tiền tố locale mà WordPress mong đợi. Hoàn thành khi phát hiện được redirect từ đường dẫn đã dịch mà không hardcode pathname.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
TypeScript
Star
204
Fork
26
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của 10up/headstartwp

Tất cả issue của 10up/headstartwp

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.