[wp-trac] [WordPress Trac] #52886: Update esc_url to allow for specifying an https:// as default protocol

WordPress Trac noreply at wordpress.org
Wed Apr 28 22:03:13 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:  5.8
Component:  Formatting                           |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-unit-tests needs-    |     Focuses:
  dev-note                                       |
-------------------------------------------------+-------------------------
Description changed by SergeyBiryukov:

Old description:

> If no protocol is specified for esc_url the function will automatically
> prepend the http:// protocol. This is likely now the wrong assumption,
> but potentially can break backwards compatibility if changed, since
> developers may rely on this.
>
> So this change proposes an additional parameter to the function to
> specify a default protocol, keeping the old default but now allowing for
> one to ask for https://
>
> This came up in this ticket:
> https://github.com/WordPress/gutenberg/pull/30100
>
> The usage could then be:
>
> ```
> esc_url( $url, null, 'display', 'https://' );
> ```

New description:

 If no protocol is specified for esc_url the function will automatically
 prepend the http:// protocol. This is likely now the wrong assumption, but
 potentially can break backwards compatibility if changed, since developers
 may rely on this.

 So this change proposes an additional parameter to the function to specify
 a default protocol, keeping the old default but now allowing for one to
 ask for https://

 This came up in this ticket:
 https://github.com/WordPress/gutenberg/pull/30100

 The usage could then be:

 {{{
 esc_url( $url, null, 'display', 'https://' );
 }}}

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52886#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list