Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Bryan Phelan
Bryan Phelan
18,191 Points

WordPress Sandbox

Hi all,

I am working with a WordPress site and want to set-up a sandbox version for testing. I am using Duplicator which seems to work great for creating a sandbox site on my local host or in a subdirectory. My concern is I have lots of users who are set-up to receive various email notices, obviously I don't want members to receive these notices from a test environment. How can I safely avoid notices going to my members? Is it easiest to just drop all the users from the database?

Thanks!

1 Answer

Sue Dough
Sue Dough
35,800 Points

If your on localhost chances are you can't send email. If you are using a staging environment that can send email then you can overwrite the wp_mail function. Place this in your wp-config.php

// stop emails
function wp_mail() {}
Bryan Phelan
Bryan Phelan
18,191 Points

Thanks. Why should this go in the wp-config.php file and not the functions.php file? Or does it make a difference?

Sue Dough
Sue Dough
35,800 Points

This is what I found from researching. I assume because its more of a configuration for a different setup then an actual function of your application. You can try out the functions file and see if it works there as well.