Created
September 13, 2018 16:22
-
-
Save jack-arturo/f8f2f871cdf79ba51a93032eeefa9d2f to your computer and use it in GitHub Desktop.
Send an email notification when an API error is encountered
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function wpf_email_notify( $timestamp, $level, $user, $message, $source, $context ) { | |
| if( $level == 'error' ) { | |
| wp_mail( 'youremail@example.com', 'WP Fusion API Error', 'Error message: ' . $message . ' for user ID ' . $user ); | |
| } | |
| } | |
| add_action( 'wpf_log_handled', 'wpf_email_notify', 10, 6 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment