-
-
Save mindctrl/8373283 to your computer and use it in GitHub Desktop.
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
<?php | |
/* | |
Plugin Name: No "New WordPress Site" E-mail | |
Description: Prevents the "New WordPress Site" e-mail from being sent out | |
Version: 0.1 | |
Author: Mark Jaquith | |
Author URI: http://coveredwebservices.com/ | |
*/ | |
class CWS_No_New_WordPress_Site_Email { | |
static $instance; | |
public function __construct() { | |
self::$instance = $this; | |
add_action( 'phpmailer_init', array( $this, 'maybe_kill_email' ) ); | |
} | |
public function maybe_kill_email( $phpmailer ) { | |
/* | |
If the subject matches, we call ->ClearAllReicpients(), which unsets all | |
recipient addresses and will cause ->Send() to error (a caught exception), | |
effectively canceling the e-mail | |
*/ | |
if ( 'New WordPress Site' === $phpmailer->Subject ) | |
$phpmailer->ClearAllRecipients(); | |
} | |
} | |
new CWS_No_New_WordPress_Site_Email; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment