lets do this

This commit is contained in:
sbyrd 2023-02-16 14:42:35 -05:00
parent 21314d8593
commit e868538be7
2 changed files with 27 additions and 1 deletions

27
staging_mail_disable.php Normal file
View File

@ -0,0 +1,27 @@
<?php
/*
Plugin Name: Staging Mail Disable
Plugin URI: https://cooini.com/services/dev/wordpress
Description: This plugin will disable will add a filter that prevents wordpress from sending mail
Version: 1.0
Author: sbyrd
Author URI: https://cooini.com/
License: MINE-all-mine
*/
$constant_requirements = ['WP_ENVIRONMENT_TYPE'=>'staging'];
$plugins = ['fluent-smtp/fluent-smtp.php'];
//Loop through our constants requirements
foreach($constant_requirements as $constant => $requirement)
{
if (constant($constant) === $requirement)
{
add_filter('pre_wp_mail', 'staging_mail_disabler');
}
}
function staging_mail_disabler() {
return false;
}

View File

@ -25,4 +25,3 @@ foreach($constant_requirements as $constant => $requirement)
break; // We only need one constant requirement to be meet
}
}