[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:13:37 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                                       |
-------------------------------------------------+-------------------------

Comment (by mkaz):

 Thanks for the follow up on this one, it had fallen off my radar.

 My potential concern with a filter is that it would apply to all
 `esc_url()` calls.

 The use case we had was to implement on the Block Editor for the social
 links, but if we did it as a filter and once it got to core it the filter
 would be implemented for everyone which is the same as default to
 `https://` everywhere.

 Also, as a filter someone else could override and then it would not pick
 the right URL for say https://twitter.com/


 @audrasjb I'm not sure it makes sense to pass in to the `clean_url`
 filter, I can't think of a scenario where it would help.


 My other thought was should we change to `esc_url_raw` to also support
 defaulting to `https://`

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


More information about the wp-trac mailing list