Non-ASCII source URLs move to opaque segment-<hash> slugs; WordPress supports UTF-8 slugs natively

Abierto
#7,727 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
56/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
php, wordpress
Área
backend, web-dev

Línea de trabajo

Start with php-transformer/src/Path/RouteSlug.php and its RouteSlug docblock to understand why non-ASCII segments become hashes. Trace how that result is used for post_name, permalinks, navigation links, templates, and route classes, then locate the relevant fixture tests. Done means Arabic and CJK routes retain distinct native WordPress slugs in stored post names, permalinks, and nav links while internal identities remain valid.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Problem

RouteSlug::segment() replaces any path segment that does not fold to ASCII (Arabic, CJK, Cyrillic, Greek, Hebrew) with the opaque token segment-<sha256[:12]>. That token becomes the page's post_name, its permalink, and its template slug. Every non-Latin source URL therefore moves. A 301 keeps old links working, but the imported site's own URLs are hashes that the owner cannot read or recognize.

WordPress has no such limit: sanitize_title_with_dashes() keeps UTF-8 letters, percent-encoded through utf8_uri_encode(), so /الصور/ is a normal WordPress permalink. #3331 treated a moved source URL as a bug (underscores); this is the same class of fidelity loss, at site scale for non-Latin sites.

Evidence (mostafa-atef.com, Arabic Wix site, DLA 0.43.24, SSI 1.42.31)

  • 31 of 47 imported pages have post_name segment-*. Titles stay correct Arabic.
  • GET /الصور/ returns 301 → /segment-bfbd183ae97c/, and the nav links point at /segment-…/.
  • Templates are named page-segment-6ea79cc5df8c, which is opaque in the Site Editor.

Context

The current design is deliberate (see the RouteSlug docblock): the canonical route grammar is [a-z0-9_-], so segments that WordPress would percent-encode get a derived token. The question is where that grammar needs to hold:

  • Internal identities (template slugs, CSS route classes, artifact paths) can keep an ASCII token.
  • The public route (post_name, permalinks, nav hrefs) can carry WordPress's own slug for the segment, so the source URL is preserved.

Expected / acceptance

  • A non-ASCII source path imports with WordPress's native slug for that path. /الصور stays /الصور/ (stored percent-encoded, as core stores it), with no redirect needed.
  • Template and route-class identities stay valid under their own grammars.
  • Two distinct non-ASCII segments never collide.
  • A fixture with an Arabic and a CJK route asserts the stored post_name, the permalink, and the nav hrefs.

Filed by Franklin (Claude Opus via Roadie/Pi) from the mostafa-atef.com import loop. Evidence comes from the imported site's wp post list, curl, and php-transformer/src/Path/RouteSlug.php on trunk.

Lenguaje dominante
PHP
Estrellas
31
Forks
7
Merge medio
7 h 50 min
PR fusionados (30 d)
822

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Automattic/blocks-engine

Todos los issues de Automattic/blocks-engine

Issues similares

Más issues de PHP

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.