-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Patterns: Use slug as fallback for empty title #54731
Conversation
Size Change: +13 B (0%) Total Size: 1.62 MB
ℹ️ View Unchanged
|
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.
Thank you, @t-hamano!
All the changes test well for me ✅
Cc-ing @aaronrobertshaw and @glendaviesnz for visibility.
Thanks for the review, @Mamaduka! |
I just cherry-picked this PR to the release/16.7 branch to get it included in the next release: cb39b6f |
Recloses #54693
What?
This PR solves the following problem by using a slug as a fallback when the pattern doesn't have a title.
json.json
Why?
In #54717, it is now required to enter a title when creating a pattern. However, by accessing
edit.php?post_type=wp_block
, you can update the title to empty just like a normal post.Therefore, we need a fallback that assumes the title is empty.
How?
If there is no title for the pattern, use the slug.
Testing Instructions
Preparation
Title in the Patterns Library
Delete Pattern
Note: Attempt to delete the pattern, but do not actually delete it.
Are you sure you want to delete ""?
.Are you sure you want to delete "my-pattern"?
.Duplicate Pattern
"" duplicated.
and the new pattern title should display as(Copy)
."{slug}" duplicated.
should be displayed and the new pattern title should be displayed as{slug} (Copy)
.Exporting Pattern
json.json
.{slug}.json
.Import Pattern