-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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 old urls to the new path based ones #7903
base: trunk
Are you sure you want to change the base?
Conversation
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 Core Committers: Use this line as a base for the props when committing in SVN:
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
This patch will have to wait for the next package update to be able to get committed. As the new urls won't work until the package update. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
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.
@youknowriad I left one question about the inclusion of an __experimental
setting. Otherwise this looks ok to me, though I'm unsure how to confirm that this is doing what is expected. From what I can tell, when I go to a URL like:
/wp-admin/site-editor.php?path=/wp_template
It redirects to a URL like:
/wp-admin/site-editor.php?p=%2Ftemplate
Is this the intended behavior? If so, it would be good to add a set of unit tests for _get_site_editor_redirection_url()
that cover this intended behavior.
Yes, this is the intended behavior. Unfortunately, I don't have time to add unit tests or work on PRs at the moment. |
- Document global - Replace `@private` with `@access`
@youknowriad I've taken the liberty of pushing to your branch and will continue to do so ;)
I'll add some unit tests once I've caught up on the ticket and am clear what they out to be. |
Thanks @peterwilsoncc Just want to add that any change you make to these "backport PRs" should ideally also be made in the Gutenberg repository. |
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 the assist, @peterwilsoncc. I think we can commit this and add tests as a follow-up.
Noticed that there was one existing test that was failing due to the new block editor setting being added. Addressed in 8da7a26. |
@joemcgill Another thing I'd like is to use a wp prefix on the function (because of course I would), are you happy if I rename it |
@peterwilsoncc I'm not opposed, but it's worth noting that there already :alot: of private functions in the global space not using this prefix (examples below). Can you also take a look at updating the relevant code in the GB repo based on your previous changes? === Some examples:
|
Yeah, I know. It's not something we committers have been consistent catching in the past but it's only possible to fix code going forward. |
Sorry, I just noticed it's using a 301 redirect rather than a 302. I think wp tends to use 302's within the admin as 301s are cached by the browser so it may produce unexpected results once the user is logged out. |
Modifies the redirects from deprecated site-editor URLs to use 302 temporary redirects rather than 301 permanent redirects. This prevents the browser from caching the redirect as the destination will differ for logged in and logged out users. This also switches from using `wp_redirect()` to `wp_safe_redirect()` in accordance with best practices when redirecting within a WordPress site. Follow up to #67199 Incorporating changes in WordPress/wordpress-develop#7903 See https://core.trac.wordpress.org/ticket/62585 Co-authored-by: peterwilsoncc <peterwilsoncc@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Modifies the redirects from deprecated site-editor URLs to use 302 temporary redirects rather than 301 permanent redirects. This prevents the browser from caching the redirect as the destination will differ for logged in and logged out users. This also switches from using `wp_redirect()` to `wp_safe_redirect()` in accordance with best practices when redirecting within a WordPress site. Follow up to #67199 Incorporating changes in WordPress/wordpress-develop#7903 See https://core.trac.wordpress.org/ticket/62585 Co-authored-by: peterwilsoncc <peterwilsoncc@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org> Source: WordPress/gutenberg@f2ea441
I think this is good to go in to Core but it will need to be committed shortly after the first package update so the redirected URLs work. |
This backports the change introduced in Gutenberg in this PR WordPress/gutenberg#67199
It includes:
Trac ticket: https://core.trac.wordpress.org/ticket/62585