You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
wp-env: Support for WP_SITEURL and WP_HOME without automatically appending port number #69776
However wp-env automatically adds a port number to the URL. The site still works but static assets like CSS & JS are not loaded. It can be fixed by editing ~/wp-env/UNIQUE_HASH/wp-config.php.
I chatted a bit with @Sukhendu2002 about this issue.
I like the idea of doing this without adding a new option, if it's possible --
whether through the existing port number option, or a slash (as @eliot-akira mentioned) if that doesn't add additional issues.
From the two proposed solutions, I like the idea of using the existing option port. There's also the env variable WP_ENV_PORT which overrides it. Setting it to an empty string sounds appropriate, but that might not be distinguishable from it being undefined. The option is documented as an integer, so maybe 0 (zero) would work..? Or false (string or boolean).
With the other idea of using a slash, there may be people who unknowingly have a trailing slash in their site URL, that wp-env might be trimming before adding the port number.
..Mm, both options seem a bit ambiguous and "implicit" behavior. It's not so clear what they're doing, to disable automatically appending the port number to the site URL.
It seems the most straight-forward implementation would be a new option preserveSiteUrl or keepSiteUrl (easier to spell/type). Or the opposite, appendSiteUrlPortNumber which is true by default. Then the config property can be readable and explains what it does.
Activity
getsource commentedon Aug 7, 2025
Thanks @eliot-akira for the issue and @Sukhendu2002 for the PR!
I chatted a bit with @Sukhendu2002 about this issue.
I like the idea of doing this without adding a new option, if it's possible --
whether through the existing port number option, or a slash (as @eliot-akira mentioned) if that doesn't add additional issues.
eliot-akira commentedon Aug 20, 2025
From the two proposed solutions, I like the idea of using the existing option
port. There's also the env variableWP_ENV_PORTwhich overrides it. Setting it to an empty string sounds appropriate, but that might not be distinguishable from it being undefined. The option is documented as an integer, so maybe0(zero) would work..? Orfalse(string or boolean).With the other idea of using a slash, there may be people who unknowingly have a trailing slash in their site URL, that
wp-envmight be trimming before adding the port number...Mm, both options seem a bit ambiguous and "implicit" behavior. It's not so clear what they're doing, to disable automatically appending the port number to the site URL.
It seems the most straight-forward implementation would be a new option
preserveSiteUrlorkeepSiteUrl(easier to spell/type). Or the opposite,appendSiteUrlPortNumberwhich istrueby default. Then the config property can be readable and explains what it does.