Created
May 2, 2018 03:14
-
-
Save salcode/52d6f88efc175ddfa965a90c50350747 to your computer and use it in GitHub Desktop.
WordPress plugin proof of concept for disabling the Stop Emails plugin from logging emails when run from the command line. See https://github.com/salcode/stop-emails/issues/15
This file contains hidden or 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: WP CLI Test Stop Emails | |
* Plugin URI: https://github.com/salcode/stop-emails/issues/15 | |
* Description: Test plugin for <a href="https://github.com/salcode/stop-emails/issues/15">Issue 15</a> | |
* Author: Sal Ferrarello | |
* Author URI: https://salferrarello.com/ | |
* Text Domain: wp-cli-test-stop-emails | |
* Domain Path: /languages | |
* Version: 0.1.0 | |
* | |
* @package Wp_Cli_Test_Stop_Emails | |
*/ | |
if ( ! class_exists( "WP_CLI" ) ) { | |
return; | |
} | |
WP_CLI::add_command( 'test-email', function() { | |
wp_mail( | |
'[email protected]', | |
'My Test Email', | |
'This is a test email that should be caught by the Stop Emails plugin', | |
[ | |
'From' => '[email protected]', | |
] | |
); | |
} ); | |
add_filter( 'option_fe_stop_emails_options', function( $fe_stop_emails_options ) { | |
if ( isset( $fe_stop_emails_options['log-email'] ) && 1 === $fe_stop_emails_options['log-email'] ) { | |
WP_CLI::log( 'My Plugin is suspending the Stop Emails Plugin from Logging Emails when run from WP CLI' ); | |
$fe_stop_emails_options['log-email'] = 0; | |
} | |
return $fe_stop_emails_options; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment