Skip to content

fetchRedirect not working on handleError with Polylang translated slugs #693

@lucymtc

Description

@lucymtc

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions