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 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( | |
'to@example.com', | |
'My Test Email', | |
'This is a test email that should be caught by the Stop Emails plugin', | |
[ | |
'From' => 'from@example.com', | |
] | |
); | |
} ); | |
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