WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#40568 new defect (bug)

Add an action in WP_Error::add()

Reported by: Shelob9 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 2.1
Component: General Keywords:
Focuses: Cc:
PR Number:

Description

It would be very useful if when an error was added in WP_Error.

Such an action would allow for the following:
1) Logging specific errors conditionally based on code.
2) A plugin that created a WP_Error log
3) Plugin developer could have an optional error logging feature for every time their plugin created a WP_Error object.

Attachments (1)

40568.diff (1.1 KB) - added by Shelob9 2 years ago.
Patch for discussion

Download all attachments as: .zip

Change History (3)

@Shelob9
2 years ago

Patch for discussion

#1 @Shelob9
2 years ago

My patch adds the action in side of WP_Error::add() It also replaces the code that is totally the same in the constructor as that method so the action is fired by adding an error through the constructor without increasing code duplication.

#2 @danielbachhuber
2 years ago

See past conversation in #28319

Note: See TracTickets for help on using tickets.