Skip to content

Add trailing slash to wp-admin URLs to prevent redirect#2680

Merged
epeicher merged 1 commit intotrunkfrom
fix/wp-admin-redirect
Feb 27, 2026
Merged

Add trailing slash to wp-admin URLs to prevent redirect#2680
epeicher merged 1 commit intotrunkfrom
fix/wp-admin-redirect

Conversation

@epeicher
Copy link
Copy Markdown
Contributor

@epeicher epeicher commented Feb 27, 2026

Related issues

  • N/A

Proposed Changes

  • Append trailing slash to /wp-admin/ URLs in the settings tab, header WP Admin button, and copy-to-clipboard actions. WordPress redirects /wp-admin to /wp-admin/, so using the canonical URL avoids an unnecessary redirect.

Note

This has been fixed in the playground repo as part of WordPress/wordpress-playground#3301, so this code will not strictly be required after playground version is updated to v3.1.2, but it saves one redirect, so it can be kept after the upgrade.

Testing Instructions

  1. Open a running site in Studio.
  2. Click the WP Admin button in the header — verify the browser opens /wp-admin/ directly without a redirect.
  3. Go to the Settings tab and copy the Admin URL — verify the copied URL ends with /wp-admin/.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@epeicher epeicher self-assigned this Feb 27, 2026
@epeicher epeicher requested a review from a team February 27, 2026 11:02
Copy link
Copy Markdown
Contributor

@katinthehatsite katinthehatsite left a comment

Choose a reason for hiding this comment

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

With this fix, for me, the URL for opening wp-admin now works as expected 👍

@wpmobilebot
Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing 0837f4a vs trunk

site-editor

Metric trunk 0837f4a Diff Change
load 1494.00 ms 1405.00 ms -89.00 ms 🟢 -6.0%

site-startup

Metric trunk 0837f4a Diff Change
siteCreation 7122.00 ms 8097.00 ms +975.00 ms 🔴 13.7%
siteStartup 4949.00 ms 4936.00 ms -13.00 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@epeicher epeicher merged commit 2440b29 into trunk Feb 27, 2026
15 checks passed
@epeicher epeicher deleted the fix/wp-admin-redirect branch February 27, 2026 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants