-
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
Site Editor: Redirect /wp_template_part/all
to /patterns
#61446
Conversation
[ '/wp_template', '/wp_template_part/all', '/pages' ].includes( | ||
path | ||
) || | ||
[ '/wp_template', '/pages' ].includes( path ) || |
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.
The concern about deleting /wp_template_part/all
from this array is discussed in this comment, but it should be possible to delete it with this PR.
Size Change: +130 B (+0.01%) Total Size: 1.75 MB
ℹ️ View Unchanged
|
/wp_template_part/all to
/patterns`/wp_template_part/all
to /patterns
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 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. |
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.
This works fine for me. Though I welcome a second opinion from someone that has more experience working with the router.
Also, this is likely to grow over time (other redirects), so I wonder if we should expose a generic "Redirect" component or something from the router package and use it in the router.js file of the site editor. |
Thanks for the review!
Moved redirect code. |
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.
Follow-up #61080
See this comment: #61080 (comment)
What?
This PR ensures that when
/wp_template_part/all
path is accessed, it will redirect to/patterns
.Why?
The All Template Parts page no longer exist, as template parts have already been integrated into the Patterns page. However, for backward compatibility, the Patterns page was displayed when this path was accessed. We should be able to completely remove references to
/wp_template_part/all
by redirecting to the/patterns
path.How?
Added redirect to
RouterProvider
. It works fine as far as I've tested it, but I'd appreciate some advice if this is the ideal approach.Testing Instructions
http://localhost:8888/wp-admin/site-editor.php?path=/wp_template_part/all
in the URL of your browser.http://localhost:8888/wp-admin/site-editor.php?path=/patterns
.