Code Snippet: Redirect All Emails on Staging Site

When troubleshooting a production site, one of the challenge is dealing with the email communication. For example, we need to debug a problem on eCommerce website, but don’t want the actual client get interrupted by all the testing email communications. Here is the code I use in troubleshooting. It redirects all email communication to me without disturbing any registered user.

First is to create a staging site for debug, never troubleshoot on live site. After setup staging site, put following code in functions.php or custom plugin of own.

Remember to replace “” to your own email address. And disable this code on production site (in case you copy staging to live site)

Comments are closed.

Post Navigation