fetchRedirect not working on handleError with Polylang translated slugs
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 42/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- next.js, typescript, wordpress
调研方向
从 handleError 和 fetchRedirect 开始,然后使用翻译后的 post-type slug 重现列出的 Polylang 和 Safe Redirect Manager 设置。将 ctx 中 resolvedUrl 的 pathname 与 WordPress 预期的带 locale 前缀的路径进行比较。在不对 pathname 进行硬编码的情况下检测到来自翻译路径的重定向,即表示完成。
由索引模型根据 Issue 内容生成。
描述
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
- Create custom post type., slug example 'programmes'
- Add translation to the post type slug in polylang, for example PT 'programas'
- Add rewrite in middleware so NextJS knows
programastranslated path isprogrammes/ - Add a redirect from from WP with Safe Redirect Manager from '/pt/programas/foo' that returns 404 to an existing page
- Within handleError function pathname is the ctx resolvedUrl which is programmes/foo
- See redirect not working.
- 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
- 主要语言
- TypeScript
- 星标
- 204
- 派生
- 26
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
10up/headstartwp 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 35/100
10up/headstartwp#950 ·
-
难度 3/5 1-2 天 新手友好度 48/100
10up/headstartwp#948 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 25/100
10up/headstartwp#902 ·
-
难度 5/5 一周以上 新手友好度 25/100
10up/headstartwp#900 ·
-
难度 5/5 一周以上 新手友好度 25/100
10up/headstartwp#857 ·
相似的 Issue
-
难度 1/5 1-3 小时 新手友好度 87/100
维护者通常 1 天内回复
-
🛠️ dette technique
难度 2/5 1-3 小时 新手友好度 61/100
betagouv/mon-entreprise#4752 · 1 条评论 ·
维护者通常 5 天内回复
-
type: bug
难度 2/5 1-3 小时 新手友好度 67/100
franciscoBSalgueiro/en-croissant#1111 ·
维护者通常 2 天内回复
-
area/providers type/feature version/v2
难度 2/5 1-3 小时 新手友好度 68/100
anomalyco/opencode#64845 · 1 条评论 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复