Last active
August 29, 2015 14:18
-
-
Save butlerblog/a2bf769b9befe7af55b3 to your computer and use it in GitHub Desktop.
A quick-and-dirty plugin to filter the email from address and name
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: QnD wp_mail filter | |
Plugin URI: http://butlerblog.com/ | |
Description: A quick and dirty plugin to change the wp_mail "from" address to be something other than [email protected]. | |
Version: 1.2 | |
Author: Chad Butler | |
Author URI: http://butlerblog.com/ | |
License: GPLv2 | |
*/ | |
/** | |
* Set 'from' and 'name' values to your | |
* email address and from name. | |
*/ | |
function qnd_mail_settings() { | |
$settings = array( | |
'from' => '[email protected]', | |
'name' => 'My Name', | |
); | |
return $settings; | |
} | |
/** no need to change anything else **/ | |
/** Filter hooks. **/ | |
add_filter( 'wp_mail_from', 'qnd_mail_from' ); | |
add_filter( 'wp_mail_from_name', 'qnd_mail_from_name' ); | |
/** | |
* Filters the email address. | |
*/ | |
function qnd_mail_from( $email ) { | |
$settings = qnd_mail_settings(); | |
return $settings['from']; | |
} | |
/** | |
* Filters the "from" name. | |
*/ | |
function qnd_mail_from_name( $name ) { | |
$settings = qnd_mail_settings(); | |
return $settings['name']; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment