Skip to content

Conversation

@adamziel
Copy link
Collaborator

@adamziel adamziel commented Nov 4, 2025

Motivation for the change, related issues

As reported in #2855, the default Playground rewrite rule malforms this URL:

 /wp-content/themes/Newspaper/includes/wp-booster/wp-admin/images/plugins/tagdiv-small.png

It transforms it to just:

/wp-admin/images/plugins/tagdiv-small.png

This PR explores making it right. I've noticed this particular case is solved by removing the initial slash from the regexp, and if the tests pass we could already merge it, but I would also like to understand why do we diverge from the original rewrite rule shipped with WordPress in the .htaccess file. Are there any other changes we need to do around rewriting?

I am wrapping up for the day and will follow up tomorrow.

Fixes #2855

Implementation details

Testing Instructions (or ideally a Blueprint)

cc @tusharsnx

cc @brandonpayton, too – do you remember any rationale around this work off the top of your head? If not, all good, I'll dig it up tomorrow.

@adamziel
Copy link
Collaborator Author

adamziel commented Nov 4, 2025

@tusharsnx btw the URL starting with /wp-content/ will not work anyway since every Playground lives at a subpath similar to /scope:my-site/. You'll need to use some WordPress helper to generate a site-relative URL, which will also solve the issue you are experiencing. I wonder if that makes this PR unnecessary, since we always expect that scope segment to come first 🤔

@tusharsnx
Copy link

tusharsnx commented Nov 5, 2025

@adamziel I'm not sure if that's also true for Playground CLI. I can see that URLs are unscoped when using wp-playground-cli server command.

The full command I'm using to start Playground server:

wp-playground-cli server --auto-mount --mount-before-install ./wordpress:/wordpress

The /wordpress installation lives alongside the code files.

image

This is an interesting discussion that happened in that thread. @bgrgicak Could you take a look here?

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.

Custom theme broken due to Playground path rewrites

3 participants