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

WordPress Trac noreply at wordpress.org
Mon Mar 22 18:00:41 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:  Awaiting Review
Component:  Formatting   |    Version:
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 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>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list