fetchRedirect not working on handleError with Polylang translated slugs

未关闭
#693 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
42/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
next.js, typescript, wordpress
领域
backend, web-dev

调研方向

从 handleError 和 fetchRedirect 开始,然后使用翻译后的 post-type slug 重现列出的 Polylang 和 Safe Redirect Manager 设置。将 ctx 中 resolvedUrl 的 pathname 与 WordPress 预期的带 locale 前缀的路径进行比较。在不对 pathname 进行硬编码的情况下检测到来自翻译路径的重定向,即表示完成。

由索引模型根据 Issue 内容生成。

描述

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
主要语言
TypeScript
星标
204
派生
26
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

10up/headstartwp 的其他 Issue

查看 10up/headstartwp 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。