Skip to content

Instantly share code, notes, and snippets.

@markjaquith
Created December 12, 2012 17:04
Show Gist options
  • Save markjaquith/4269587 to your computer and use it in GitHub Desktop.
Save markjaquith/4269587 to your computer and use it in GitHub Desktop.
WordPress plugin that prevents the "New WordPress Site" e-mail from being sent out
<?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