-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Fix: save custom template with non-latin slug #69732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @shadigaafar. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: -1 B (0%) Total Size: 1.85 MB
ℹ️ View Unchanged
|
I wonder if there's an actual use case for non-Latin template slugs, but it could be a limitation of using custom template titles to generate slugs instead of having a separate input. P.S. I'm not dissmissing non-Latin languages; my native Georgian is one, but I never liked using it for slugs and URLs 😅 |
@Mamaduka Thanks for the feedback!
Yes, ideally, We may need to prepare the additional input field for the slug. (Related discussion: #65568 (comment)) This PR just makes the logic in the post editor consistent with the logic in the site editor. It might be a temporary fix in some sense. |
packages/editor/src/components/post-template/create-new-template-modal.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a minor note, but besides that, the fix works as expected ✅
Thank you, @t-hamano!
…te-modal.js Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com>
Flaky tests detected in f12ba66. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/14124709118
|
* Fix: save custom template with non-latin slug * Update packages/editor/src/components/post-template/create-new-template-modal.js Co-authored-by: George Mamadashvili <georgemamadashvili@gmail.com> * Site Editor: avoid prefixing when the title is with latin chars --------- Unlinked contributors: shadigaafar. Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org> Co-authored-by: Thelmachido <thelmachido@git.wordpress.org> Co-authored-by: mburridge <mburridge@git.wordpress.org>
What?
Similar to #38861
Closes #41214
Fix the error occurring in the post editor when creating a new template with non-latin slug
Why?
In my understanding, templates and template parts don't allow non-Latin characters as a slug.
cleanForSlug()
function preserves non-latin characters, so an error occurs.How?
Use the same logic as here.
In the future, we may want to allow non-Latin characters.
Testing Instructions
wp-custom-template
slugwp-custom-template-2
.