Skip to content

Add preserveSiteUrl option to prevent port appending to the site URL - #69817

Open
Sukhendu2002 wants to merge 2 commits into
WordPress:trunkfrom
Sukhendu2002:add/wp-env-preserve-urls
Open

Sukhendu2002 wants to merge 2 commits into
WordPress:trunkfrom
Sukhendu2002:add/wp-env-preserve-urls

Conversation

@Sukhendu2002

@Sukhendu2002 Sukhendu2002 commented Apr 4, 2025 •

Copy link
Copy Markdown
Contributor

What?

Closes : #69776

This PR adds a new preserveSiteUrl option to wp-env that prevent port number from being appended to the site URL in config values like WP_SITEURL and WP_HOME.

Sample .wp-env.json

{
  "preserveSiteUrl": true,
  "config": {
    "WP_SITEURL": "https://wp.local",
    "WP_HOME": "https://wp.local"
  }
}

@Sukhendu2002
Sukhendu2002 marked this pull request as ready for review April 4, 2025 07:56
@github-actions

github-actions Bot commented Apr 4, 2025 •

Copy link
Copy Markdown

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: Sukhendu2002 <sukhendu2002@git.wordpress.org>
Co-authored-by: eliot-akira <miyarakira@git.wordpress.org>

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

@eliot-akira

eliot-akira commented Apr 4, 2025 •

Copy link
Copy Markdown

Oh wow, thank you for implementing the feature, @Sukhendu2002. That's very thorough, including:

  • Test for the new option preserveUrls
  • Updated JSON schema for wp-env.json
  • Documentation

One point I wonder about is the naming of the option, if there might be a more specific name that describes its purpose. The current name sounds like it affects all URL values, to prevent them from being processed in any way.

..How about the documentation can mention that it only affects the site URL.

-prevent port numbers from being automatically appended to URLs
+prevent port number from being appended to the site URL

Maybe the option name can be preserveSiteUrl. It's singular because the site URL is unique, same with port number. The word "automatically" is probably unnecessary in the description.


About "unlinked contributors" mentioned by the @github-actions bot, I linked my GitHub and wp.org accounts according to the article.

@t-hamano t-hamano added [Type] Enhancement A suggestion for improvement. [Tool] Env /packages/env labels Apr 5, 2025
@Sukhendu2002 Sukhendu2002 changed the title Add preserveUrls option to prevent port appending Add preserveSiteUrl option to prevent port appending to the site URL Apr 7, 2025

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Tool] Env /packages/env [Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wp-env: Support for WP_SITEURL and WP_HOME without automatically appending port number

3 participants