Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment