[wp-trac] [WordPress Trac] #57686: Introduce wp_trigger_error() to compliment _doing_it_wrong()

WordPress Trac noreply at wordpress.org
Tue Sep 26 12:37:06 UTC 2023


#57686: Introduce wp_trigger_error() to compliment _doing_it_wrong()
-------------------------------------------------+-------------------------
 Reporter:  azaozz                               |       Owner:
                                                 |  hellofromTonya
     Type:  enhancement                          |      Status:  closed
 Priority:  normal                               |   Milestone:  6.4
Component:  General                              |     Version:
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  needs-dev-note has-patch has-unit-   |     Focuses:
  tests commit                                   |
-------------------------------------------------+-------------------------
Changes (by hellofromTonya):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"56707" 56707]:
 {{{
 #!CommitTicketReference repository="" revision="56707"
 General: Use wp_kses() in wp_trigger_error().

 Uses `wp_kses()` instead of `esc_html()` to allow a list of HTML tags and
 protocols in the message rather than escaping them.

 Why? To retain message readability in the browser and server logs,
 especially given that Core itself adds HTML to messages in functions, e.g.
 `_doing_it_wrong()` and each of the `_deprecated_*()` functions.

 HTML tags allowed:
 * `a href`
 * `br`
 * `code`
 * `em`
 * `strong`

 Protocols allowed: `http` and `https`.

 To inform extenders, it also documents that any other HTML tags or
 protocols need to be escaped before passing the message to this function
 to avoid them being stripped from the message.

 Follow-up to [56530], [56705].

 Props azaozz, costdev, flixos90, hellofromTonya, peterwilsoncc.
 Fixes #57686.
 }}}

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


More information about the wp-trac mailing list