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

WordPress Trac noreply at wordpress.org
Thu Feb 9 22:11:48 UTC 2023


#57686: Introduce wp_trigger_error() to compliment _doing_it_wrong()
-------------------------+--------------------
 Reporter:  azaozz       |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  6.3
Component:  General      |    Version:
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+--------------------
 The `_doing_it_wrong()` function was introduced 12 years ago (see #15824
 and [16939]) for "telling people the code they have written won't work".
 Since then it has been used quite a bit, currently at around 180 places in
 core as it is a convenient way to trigger a PHP user error.

 However that convenience has resulted in shifting the initial purpose,
 which was to tell developers they are doing something wrong. Lately
 `_doing_it_wrong()` seems to be used in any context, not specifically to
 "tell off" the developers and get them to fix their code.

 In that terms I think it would be good to have a "general use" function
 that has similar functionality but "milder" messaging. Such function can
 be used by the current `_doing_it_wrong()`, and should be enhanced a
 little to handle the combinations of all PHP debugging constants:
 `WP_DEBUG`, `WP_DEBUG_DISPLAY`, and `WP_DEBUG_LOG`.

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


More information about the wp-trac mailing list