Avoid sending mails when working locally.
<?php
/**
* Avoid sending mails when working locally.
*/
if ( ! function_exists( 'wp_mail' )
&& defined( 'WP_STAGE' )
&& 'local' == WP_STAGE
&& ( ! defined( 'WP_MAIL_LOCAL' ) || true !== WP_MAIL_LOCAL )
) {
function wp_mail( $to, $subject, $message, $headers = '' ) {
return false;
}
}