[wp-trac] [WordPress Trac] #52886: Update esc_url to allow for specifying an https:// as default protocol
WordPress Trac
noreply at wordpress.org
Thu Sep 9 04:08:44 UTC 2021
#52886: Update esc_url to allow for specifying an https:// as default protocol
-------------------------------------------------+-------------------------
Reporter: mkaz | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Future
| Release
Component: Formatting | Version:
Severity: normal | Resolution:
Keywords: has-patch needs-unit-tests needs- | Focuses:
dev-note |
-------------------------------------------------+-------------------------
Comment (by costdev):
Replying to [comment:10 mkaz]:
> In this case, would wp_is_using_https()Docs be appropriate
regarding "known to use https://" as it tests the home and site URLs?
>
> No, unfortunately that wouldn't solve the case I'm looking for, that
function only works for the current site while the `esc_url()` function
can be passed any arbitrary URL which it won't know if it is SSL or not.
>
> The example is a Twitter profile link passed in like: `twitter.com/mkaz`
ideally it would by default return `https` but `esc_url()` will return
`http`.
----
True! I believe I misinterpreted `if the site is known to use https` to
refer to ''the current site'' rather than ''the remote site''. Your patch
resolves the ticket's issue without any BC breaks and I agree that
`esc_url_raw()` should be updated to support a `$default_protocol` as
well.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52886#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list