Skip to content

Add --assume-https flag to fix URL scheme issues for all WordPress URL functions#6228

Draft
Copilot wants to merge 7 commits intomainfrom
copilot/fix-http-to-https-network-url
Draft

Add --assume-https flag to fix URL scheme issues for all WordPress URL functions#6228
Copilot wants to merge 7 commits intomainfrom
copilot/fix-http-to-https-network-url

Conversation

Copy link
Contributor

Copilot AI commented Feb 4, 2026

Fix network_site_url() and network_home_url() returning HTTP instead of HTTPS

  • Revert hook-based approach
  • Add --assume-https configuration option to config-spec.php
  • Implement logic to set $_SERVER['HTTPS'] when --assume-https is enabled
  • Remove existing hooks for home_url and site_url (no longer needed)
  • Update tests to use --assume-https flag
  • Test all four URL functions: site_url(), home_url(), network_site_url(), network_home_url()
  • Pass all linting, code style, and static analysis checks
  • Address all code review feedback
  • Fix failing tests:
    • Updated cli.feature to expect 20 parameters (added assume-https)
    • Updated framework.feature to expect trailing slashes for network URLs
  • All changes complete and validated
Original prompt

This section details on the original issue you should resolve

<issue_title>network_site_url() is returned with HTTP instead of HTTPS</issue_title>
<issue_description>## Bug Report

Describe the current, buggy behavior

Basically the same problem as in #4459, but for a different command (as already noticed there by @uglyrobot):

wp eval "echo network_site_url();" always returns the network site URL with http, even though it is https.

Describe how other contributors can replicate this bug

$ wp eval "echo network_site_url();"
http://example.com
$ wp option get siteurl
https://example.com

Describe what you expect as the correct outcome

wp eval "echo network_site_url();" should return the same as wp option get siteurl.

Let us know what environment you are running this on

OS:	Linux 6.1.0-21-arm64 wp-cli/wp-cli#1 SMP Debian 6.1.90-1 (2024-05-03) aarch64
Shell:	/bin/bash
PHP binary:	/usr/bin/php8.3
PHP version:	8.3.10
php.ini used:	/etc/php/8.3/cli/php.ini
MySQL binary:	/usr/bin/mysql
MySQL version:	mysql  Ver 15.1 Distrib 10.11.6-MariaDB, for debian-linux-gnu (aarch64) using  EditLine wrapper
SQL modes:
WP-CLI root dir:	phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:	phar://wp-cli.phar/vendor
WP_CLI phar path:	/
WP-CLI packages dir:
WP-CLI cache dir:	/home/.wp-cli/cache
WP-CLI global config:
WP-CLI project config:
WP-CLI version:	2.11.0

Provide a possible solution

Generate network_site_url() without set_url_scheme(), similarly to #4473.
</issue_description>

<agent_instructions>I'm wondering if we shouldn't rather allow for a flag like --assume-https that could be set in the wp-cli.yml file for a site and that would then make sure is_ssl() returns true...</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix network_site_url to return HTTPS instead of HTTP Fix network_site_url() and network_home_url() returning HTTP instead of HTTPS Feb 4, 2026
Copilot AI requested a review from swissspidy February 4, 2026 02:28
@swissspidy

This comment was marked as resolved.

This comment was marked as resolved.

@swissspidy

This comment was marked as resolved.

@codecov
Copy link

codecov bot commented Feb 4, 2026

Codecov Report

❌ Patch coverage is 75.00000% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
php/WP_CLI/Runner.php 50.00% 3 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copilot AI and others added 3 commits February 4, 2026 03:28
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
…ting HTTPS

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>

This comment was marked as resolved.

Copilot AI changed the title Fix network_site_url() and network_home_url() returning HTTP instead of HTTPS Add --assume-https flag to fix URL scheme issues for all WordPress URL functions Feb 4, 2026
@swissspidy

This comment was marked as resolved.

…etwork URL trailing slashes

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>

This comment was marked as resolved.

This comment was marked as resolved.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

network_site_url() is returned with HTTP instead of HTTPS

2 participants