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

WordPress Trac noreply at wordpress.org
Wed Sep 13 17:41:27 UTC 2023


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

Comment (by flixos90):

 @hellofromTonya That approach could potentially work, though still
 escaping is not a one-size-fits-all, so we need to think through whether
 universally running `esc_html()` on all error messages makes sense.

 How common is it to trigger errors/warnings that include e.g. a `<strong>`
 tag or something similar?

 Fundamentally, for those concerns I am personally not convinced of a
 central escaping solution. If that made sense, then why don't we already
 have something like `wp_echo( $str )` and disallow all usage of the native
 `echo`? I think it is partly because universal escaping does not satisfy
 the use-cases. Developers have to be able to pick between `esc_html()`,
 `wp_kses()` etc., for what suits best the kind of message they are using.

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


More information about the wp-trac mailing list