-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Default template lookup should use slug, not the full permalink, in the site editor #54599
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
|
Size Change: -2 B (0%) Total Size: 1.62 MB
ℹ️ View Unchanged
|
draganescu
left a comment
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.
ntsekouras
left a comment
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://xxxxxinstead 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
linkproperty with the correctslugproperty.Testing Instructions
https://store.local/wp-json/wp/v2/templates/lookup?slug=page-https%3A%2F%2Fstore.local%2Fcart%2F&_locale=useror 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=useror similar. Note theslugparameter is fixed.