-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Default template lookup should use slug, not the full permalink, in the site editor #54599
Conversation
Size Change: -2 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.
Didn't test but the change makes sense since the called function clearly expects a slug not the whole link.
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.
Thanks for fixing this @mikejolley !
What?
#51477 introduced template swap UX, but in doing so it broke the default template lookup. Details and screenshots of the issue can be found in the issue here but the heart of the issue was that requests to the API were including the permalink instead of the slug, so for example, it tried to lookup the slug
page-http://xxxxx
instead ofpage-slug
.Why?
This restores the correct template for pages and avoids them defaulting to "pages" template, even if custom templates are in place.
How?
This replaces the
link
property with the correctslug
property.Testing Instructions
https://store.local/wp-json/wp/v2/templates/lookup?slug=page-https%3A%2F%2Fstore.local%2Fcart%2F&_locale=user
or similar. After this patch you'll see the correct lookup address ofhttps://store.local/wp-json/wp/v2/templates/lookup?slug=page-cart%2F&_locale=user
or similar. Note theslug
parameter is fixed.