[wp-trac] [WordPress Trac] #40568: Add an action in WP_Error::add()

WordPress Trac noreply at wordpress.org
Fri Sep 11 20:17:16 UTC 2020

#40568: Add an action in WP_Error::add()
 Reporter:  Shelob9                 |       Owner:  johnbillion
     Type:  enhancement             |      Status:  reviewing
 Priority:  normal                  |   Milestone:  5.6
Component:  General                 |     Version:  2.1
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:
Changes (by johnbillion):

 * keywords:  has-patch commit => has-patch dev-feedback


 Hooks aren't free of course, but there are plenty of hooks that can fire
 hundreds of times during a request, eg. `esc_html`, `gettext`, and
 `map_meta_cap`. This isn't a reason to avoid introducing useful new hooks.

 The discussion on #28319 is interesting and one that I'd forgotten about.

 The primary reason I'd like to track `WP_Error` objects is to find ones
 which "disappear", eg. by being turned into boolean false as they bubble
 up. If the end result is boolean false, there can often be a more
 descriptive `WP_Error` further down the stack.

 My plan for my Query Monitor plugin is to only log data about
 `is_wp_error()` calls when the parameter is an error, hence the `$is`
 parameter that I added. It simply don't do anything when the "thing" isn't
 an error.

Ticket URL: <https://core.trac.wordpress.org/ticket/40568#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list