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.
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. |
oandregal
left a comment
There was a problem hiding this comment.
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. |


Follow-up #61080
See this comment: #61080 (comment)
What?
This PR ensures that when
/wp_template_part/allpath 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/allby redirecting to the/patternspath.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/allin the URL of your browser.http://localhost:8888/wp-admin/site-editor.php?path=/patterns.