[wp-trac] [WordPress Trac] #47577: Detect HTTPS support and provide guidance
WordPress Trac
noreply at wordpress.org
Sat Oct 17 21:08:16 UTC 2020
#47577: Detect HTTPS support and provide guidance
--------------------------------------+-----------------------------
Reporter: flixos90 | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: Security | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses: administration
--------------------------------------+-----------------------------
Comment (by westonruter):
@flixos90 Yeah, calling `site_url()` to determine the underlying URL
scheme seems problematic since `set_url_scheme()` will override that
underlying scheme.
So it seems that `get_option('siteurl')` will work, and it will also
account for the case where someone has defined the `siteurl` via the
`WP_SITEURL` constant, since this is enforced via a lower-level
`option_siteurl` filter rather than the `site_url` filter.
The only concern I have is if a site is using the `site_url` filter to
manipulate the `siteurl` to be something else rather than what is returned
by `get_option('siteurl')`. I suppose that would be a rare scenario. But
one possibility to ensure to account for that would be to apply the
filters yourself:
{{{#!php
<?php
$site_url = apply_filters( 'site_url', get_option( 'siteurl' ), '/', null,
get_current_blog_id() );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47577#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list