Skip to content

Instantly share code, notes, and snippets.

@tarecord
Created February 7, 2023 03:22
Show Gist options
  • Save tarecord/cc1936c9786461ec5d03f37fd223ff11 to your computer and use it in GitHub Desktop.
Save tarecord/cc1936c9786461ec5d03f37fd223ff11 to your computer and use it in GitHub Desktop.
A plugin that disables all WordPress emails sent using wp_mail()
<?php
/**
* Plugin Name: Disable Email
* Plugin URI: https://www.tannerrecord.com/micro-plugins/disable-email
* Description: A plugin that disables all email sent using <code>wp_mail()</code>.
* Author: Tanner Record
* Author URI: https://www.tannerrecord.com
* Update URI: false
* Version: 1.0
*/
add_filter( 'pre_wp_mail', 'tarecord_disable_email' );
function tarecord_disable_email() {
do_action( 'wp_mail_succeeded' );
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment