You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Some inappropriate characters are included in auto-generated permalinks #12907
[Feature] PermalinkThe permalink of a post or page and the experience of setting or editing it[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended
In WordPress 5.0.1, creating a post or page with colons or exclamation marks in the title produces a permalink that takes the expected post/page slug form (lowercase alphanumeric with hyphens instead of spaces) but includes these special characters. Once the post/page is published the characters are stripped from the permalink.
To Reproduce
Steps to reproduce the behavior:
Create a new post or page.
Enter a title with colons or exclamation marks.
Save draft.
Inspect the permalink.
Expected behavior
The permalink should contain only alphanumeric characters and hyphens, even before publishing the post/page.
Screenshots
The bug visible in the page title:
The bug visible in the document inspector:
Desktop:
OS: macOS Mojave 10.14.2
Safari 12.0.2
Additional context
I'm using the WordPress 5.0.1 bundled version of Gutenberg.
Other characters may be included as well, but I ran into the issue with these two (colon and exclamation mark) and haven't explored further.
It depends a bit on where the issue is. I'd probably start with a PR here and if there are some fixes necessary on the core side, create a patch on https://core.trac.wordpress.org/ticket/45478 as well.
I searched for this issue in WordPress with Gutenberg. Found some another tickets about this problem. Is there any news about this issue ? Still there with WordPress 5.1.1.
thanks for reopening the ticket. There are still problems mit other languages when saving the post as a draft. As stated in #16695 by @uok german "Umlauts" are not treaded properly (tested in 5.9.1).
When creating a new post and entering a title like "Am nächsten Tag" and saving the post as a draft, the JS function mentioned above ( cleanForSlug() ) creates the slug "am-nachsten-tag" which is wrong. It has to be "am-naechsten-tag".
If you save the post with other post-stati like "publish" or "future" the right slug is being created.
The problem is that our editorial team is working with drafts to share the posts with other team members etc. They also use the generated slug / permalink for other purposes. For example: They copy the permalink and enter it in a browser push service. At the point the browser push is send out to thousands of users, the permalink has changed already because the post-status was now changed to "publish" and therefore the right slug was generated. Now all the users that click on the push message will see a 404 error page because the url was not found. And there are other cases in which this behavior causes problems.
Since sanitize_title() is working like a charm on the PHP side, i have created this "light" workaround in our own plugin until the core JS function does handle this as well:
public function sanitizeDraftPermalink( array $postData ) : array
{
if ( $postData['post_status'] === 'draft' && empty( $postData['post_name'] ) ) {
$postData['post_name'] = sanitize_title( $postData['post_title'] );
}
return $postData;
}
Of course the JS side is not affected by this. So if you save the post as a draft, the wrong slug is still being created and shown. But if you reload the post now, the right slug is shown. At least that helps a little bit.
Maybe there is a way to adopt the behavior from sanitize_title() on the JS side.
@khoipro could I ask you to send me a thorough list of all the accented characters?
My initial research shows that there are a bunch of different combinations of diacritics in every single character and I want to make sure I'm not missing any. Thanks in advance!
Vietnamese support was added in the latest version of remove-accents and I'm bumping its version and adding a test in #53420. From what I understand once we land it, we can close this issue.
After shipping #53420 I've closed this one, but if there's any additional character needing support, feel free to reopen or open a new issue and I'd be happy to take care of it!
Reopening the German umlaut issue, as this is still present and has a real data-integrity impact that wasn't fully described before.
The core problem
German umlauts require locale-specific digraph replacements, not simple diacritic removal:
ä → ae,ö → oe, ü → ue, ß → ss (correct, German/de_DE)
ä → a, ö → o, ü → u, ß → s (what cleanForSlug() currently produces)
This is not a missing character mapping — it's a locale rule that only applies in German context. PHP's remove_accents() handles this via a de_DE locale check. The remove-accents npm package has no locale concept, so it always produces the non-German result.
Steps to reproduce — cosmetic only (wrong preview)
Set site language to de_DE (Settings → General → Site Language)
Open the block editor, create a new post
Enter title: Künstler überraschen Hörer
Observe slug preview in the editor: kunstler-uberraschen-horer
Publish without touching the slug
Observe actual saved permalink: kuenstler-ueberraschen-hoerer ✓
Server-side sanitize_title() generates the correct slug on publish because post_name is empty and PHP uses the site locale. So far, cosmetic only.
Steps to reproduce — real data integrity bug
Same setup, steps 1–4 above
Observe that the editor shows kunstler-uberraschen-horer
Click the slug to edit it — normal SEO workflow, user wants to shorten it
The slug input is pre-filled with the wrong JS-generated value
User types a shortened version based on what they see: kunstler-horer (missing the ue replacements)
Once a user manually edits the slug, WordPress locks it — subsequent title changes no longer update it. The wrong transliteration is now permanent and the post has the wrong URL for its entire lifetime.
Why this affects editorial teams specifically
Our editors routinely customize slugs for SEO. The workflow is: write title → check auto-generated slug → shorten/optimize → publish. Step 2 of that workflow now shows them a wrong value, and any edit they make at step 3 bakes that wrong value in.
###Possible fix
The cleanest solution would be for the editor to use the generated_slug field already returned by the REST API (computed server-side via sanitize_title()) to populate/correct the slug preview, rather than relying solely on client-side cleanForSlug(). The server already does the right thing — the editor just isn't using its output.
Alternatively, locale-specific rules could be added to cleanForSlug() / remove-accents, using the site locale available from the REST API settings endpoint.
Disclaimer: Research and documentation supported by Claude Code and results verified by myself.
Edit: @tyxla I can't reopen it, missing the rights to it, would you be so kind to reopen it?
[Feature] PermalinkThe permalink of a post or page and the experience of setting or editing it[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended
Activity
swissspidy commentedon Dec 15, 2018
Core ticket: https://core.trac.wordpress.org/ticket/45588
greatislander commentedon Dec 15, 2018
@swissspidy would it be more appropriate to submit a PR to this repo or a patch to core? Might have a chance to look at this.
swissspidy commentedon Dec 28, 2018
It depends a bit on where the issue is. I'd probably start with a PR here and if there are some fixes necessary on the core side, create a patch on https://core.trac.wordpress.org/ticket/45478 as well.
apermo commentedon Jan 16, 2019
Same problem here, including that umlaute are displayed wrong as long as the post is a draft.
So ä becomes a, instead of ae, as it should. Once its saved, everything is ok.
Dominic-t3ch commentedon Mar 15, 2019
I searched for this issue in WordPress with Gutenberg. Found some another tickets about this problem. Is there any news about this issue ? Still there with WordPress 5.1.1.
Thanks
khoipro commentedon Nov 23, 2021
Could we reopen this ticket? Our Vietnamese language still has an issue with that slug. @swissspidy @earnjam @ocean90
Track my ticket https://core.trac.wordpress.org/ticket/54492
Thanks, @SergeyBiryukov for referring here.
IIM-Arvid commentedon Feb 23, 2022
Hi,
thanks for reopening the ticket. There are still problems mit other languages when saving the post as a draft. As stated in #16695 by @uok german "Umlauts" are not treaded properly (tested in 5.9.1).
When creating a new post and entering a title like "Am nächsten Tag" and saving the post as a draft, the JS function mentioned above ( cleanForSlug() ) creates the slug "am-nachsten-tag" which is wrong. It has to be "am-naechsten-tag".
If you save the post with other post-stati like "publish" or "future" the right slug is being created.
The problem is that our editorial team is working with drafts to share the posts with other team members etc. They also use the generated slug / permalink for other purposes. For example: They copy the permalink and enter it in a browser push service. At the point the browser push is send out to thousands of users, the permalink has changed already because the post-status was now changed to "publish" and therefore the right slug was generated. Now all the users that click on the push message will see a 404 error page because the url was not found. And there are other cases in which this behavior causes problems.
Since sanitize_title() is working like a charm on the PHP side, i have created this "light" workaround in our own plugin until the core JS function does handle this as well:
add_filter( 'wp_insert_post_data', array( $this, 'sanitizeDraftPermalink' ) );
public function sanitizeDraftPermalink( array $postData ) : array
{
if ( $postData['post_status'] === 'draft' && empty( $postData['post_name'] ) ) {
$postData['post_name'] = sanitize_title( $postData['post_title'] );
}
return $postData;
}
Of course the JS side is not affected by this. So if you save the post as a draft, the wrong slug is still being created and shown. But if you reload the post now, the right slug is shown. At least that helps a little bit.
Maybe there is a way to adopt the behavior from sanitize_title() on the JS side.
Thank you very much
9 remaining items
tyxla commentedon Nov 3, 2022
Yes.
Oops, seems like we forgot to tag the release here and only did it in npm. Just published it on GitHub as well: https://github.com/tyxla/remove-accents/releases/tag/v0.4.3. Thanks, @swissspidy!
tyxla commentedon Nov 22, 2022
@khoipro could I ask you to send me a thorough list of all the accented characters?
My initial research shows that there are a bunch of different combinations of diacritics in every single character and I want to make sure I'm not missing any. Thanks in advance!
khoipro commentedon Feb 17, 2023
@tyxla @SergeyBiryukov I bump this ticket again.
Here is the example of how to sanitize Vietnamese characters slug by another guy, but it works: https://gist.github.com/khoatran/8afeccd7a44c52ad39cfee00a093ec31
Another case as old plugin:
https://github.com/wp-plugins/vietnamese-slug/blob/master/vietnamese_slug.php
tyxla commentedon Feb 20, 2023
@khoipro - thanks, I'm happy to work on a new version of
remove-accentsthat includes all those strings. Stay tuned.tyxla commentedon Aug 8, 2023
Vietnamese support was added in the latest version of
remove-accentsand I'm bumping its version and adding a test in #53420. From what I understand once we land it, we can close this issue.@khoipro let me know if that works well for you.
tyxla commentedon Aug 10, 2023
After shipping #53420 I've closed this one, but if there's any additional character needing support, feel free to reopen or open a new issue and I'd be happy to take care of it!
apermo commentedon Mar 5, 2026
Reopening the German umlaut issue, as this is still present and has a real data-integrity impact that wasn't fully described before.
The core problem
German umlauts require locale-specific digraph replacements, not simple diacritic removal:
ä→ae,ö→oe,ü→ue,ß→ss(correct, German/de_DE)ä→a,ö→o,ü→u,ß→s(whatcleanForSlug()currently produces)This is not a missing character mapping — it's a locale rule that only applies in German context. PHP's
remove_accents()handles this via a de_DE locale check. The remove-accents npm package has no locale concept, so it always produces the non-German result.Steps to reproduce — cosmetic only (wrong preview)
Künstler überraschen Hörerkunstler-uberraschen-horerkuenstler-ueberraschen-hoerer✓Server-side
sanitize_title()generates the correct slug on publish becausepost_nameis empty and PHP uses the site locale. So far, cosmetic only.Steps to reproduce — real data integrity bug
kunstler-uberraschen-horerkunstler-horer(missing theuereplacements)kunstler-horer— permanently wrongOnce a user manually edits the slug, WordPress locks it — subsequent title changes no longer update it. The wrong transliteration is now permanent and the post has the wrong URL for its entire lifetime.
Why this affects editorial teams specifically
Our editors routinely customize slugs for SEO. The workflow is: write title → check auto-generated slug → shorten/optimize → publish. Step 2 of that workflow now shows them a wrong value, and any edit they make at step 3 bakes that wrong value in.
###Possible fix
The cleanest solution would be for the editor to use the
generated_slugfield already returned by the REST API (computed server-side viasanitize_title()) to populate/correct the slug preview, rather than relying solely on client-sidecleanForSlug(). The server already does the right thing — the editor just isn't using its output.Alternatively, locale-specific rules could be added to
cleanForSlug()/ remove-accents, using the site locale available from the REST API settings endpoint.Disclaimer: Research and documentation supported by Claude Code and results verified by myself.
Edit: @tyxla I can't reopen it, missing the rights to it, would you be so kind to reopen it?
fix(editor): use generated_slug in getEditedPostSlug
fix(url,editor): locale-aware slug preview for German umlauts and dig…
tyxla commentedon Mar 9, 2026
This is an interesting problem, thanks @apermo, reopening!