Created
July 14, 2019 09:24
-
-
Save oterox/56cbe7cdf445787ed696d156e11e9a58 to your computer and use it in GitHub Desktop.
Redirect All Emails on Staging Site
This file contains 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
add_filter( 'wp_mail', 'ox_redirect_email_filter', 10, 1 ); | |
function ox_redirect_email_filter( $args ) { | |
// Get original To address | |
$original_to = $args['to']; | |
// Send to developer only | |
$args['to'] = 'oterox@developer.com'; | |
// Show original To address in message for debug | |
$args['message'] = sprintf( "Message is originally sent to: [%s]", $original_to ) . $args['message']; | |
return $args; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment