Skip to content

Conversation

@peterwilsoncc
Copy link
Contributor

@peterwilsoncc peterwilsoncc commented Jan 30, 2025

What?

Follow up to #67199
Incorporating changes in WordPress/wordpress-develop#7903
See https://core.trac.wordpress.org/ticket/62585
See #67199

  • Adds docblock to gutenberg_get_site_editor_redirection()
  • Uses wp_safe_redirect()
  • Uses temporary redirect instead of a 301

Why?

Bringing suggested changes from WordPress/wordpress-develop#7903 to the plugin

  • Docblocks are good
  • For redirects within WP it's best to use safe redirects to validate the destination
  • Logged in and logged out users will be redirected to different locations, so 302 redirects are needed to ensure the browser doesn't cache an incorrect destination

How?

As above.

Testing Instructions

  1. Log in to WP
  2. Visit a deprecated site editor URL
  3. Ensure it redirects to the expected location
  4. [Repeat for multiple deprecated URLs]
  5. Log out of WP
  6. Visit a deprecated site editor URL
  7. Ensure it redirects to the login screen rather than the new URL

If you've tested the redirection of site editor URLs in the past, your browser may have the permanent redirects cached. If that is the case, you will need to test in a browser you don't usually use.

Testing Instructions for Keyboard

N/A

Screenshots or screencast

N/A

@peterwilsoncc peterwilsoncc added the [Type] Code Quality Issues or PRs that relate to code quality label Jan 30, 2025
@peterwilsoncc peterwilsoncc self-assigned this Jan 30, 2025
@peterwilsoncc peterwilsoncc marked this pull request as ready for review January 30, 2025 23:54
@github-actions
Copy link

github-actions bot commented Jan 30, 2025

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: peterwilsoncc <[email protected]>
Co-authored-by: Mamaduka <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions
Copy link

Flaky tests detected in 6ec9aca.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/13063322070
📝 Reported issues:

Copy link
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @peterwilsoncc!

@peterwilsoncc peterwilsoncc added the [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") label Feb 1, 2025
@peterwilsoncc peterwilsoncc merged commit f2ea441 into trunk Feb 1, 2025
72 checks passed
@peterwilsoncc peterwilsoncc deleted the fast-follow/67199-redirect-site-editor-urls branch February 1, 2025 00:53
@github-actions github-actions bot added this to the Gutenberg 20.3 milestone Feb 1, 2025
Kallyan01 pushed a commit to Kallyan01/gutenberg that referenced this pull request Feb 24, 2025
…68971)

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 WordPress#67199
Incorporating changes in WordPress/wordpress-develop#7903
See https://core.trac.wordpress.org/ticket/62585

Co-authored-by: peterwilsoncc <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
chriszarate pushed a commit to chriszarate/gutenberg that referenced this pull request Jul 1, 2025
…68971)

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 WordPress#67199
Incorporating changes in WordPress/wordpress-develop#7903
See https://core.trac.wordpress.org/ticket/62585

Co-authored-by: peterwilsoncc <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants