Return to Snippet

Revision: 87715
at December 8, 2021 22:36 by chrisaiv


Updated URL
https://www.chrisjmendez.com/2014/09/18/wordpress-change-admin-e-mail-to-new-users/

Updated Code
https://www.chrisjmendez.com/2014/09/18/wordpress-change-admin-e-mail-to-new-users/

Updated Description
https://www.chrisjmendez.com/2014/09/18/wordpress-change-admin-e-mail-to-new-users/

Revision: 67399
at September 18, 2014 03:40 by chrisaiv


Initial Code
/** ******** ******** ******** ******** ******** ******** ******** ******** 
* TITLE:       Change admin e-mail to new users
* DESCRIPTION: auto-detect the server so you only have to enter the front/from half of the email address, including the @ sign
* 
* http://snipplr.com/view/77687/wordpress-change-admin-email-to-new-users/
* http://miloguide.com/filter-hooks/wp_mail_from_name/
* http://premium.wpmudev.org/blog/wordpress-email-settings/
* 
*/
function admin_email_filter_wp_mail_from($email){
	/* start of code lifted from wordpress core, at http://svn.automattic.com/wordpress/tags/3.4/wp-includes/pluggable.php */
	$sitename = strtolower( $_SERVER['SERVER_NAME'] );
	if ( substr( $sitename, 0, 4 ) == 'www.' ) {
		$sitename = substr( $sitename, 4 );
	}
	/* end of code lifted from wordpress core */
	$myfront = "whateverIwant@";
	$myback = $sitename;
	$myfrom = $myfront . $myback;
	return $myfrom;
}
add_filter("wp_mail_from", "admin_email_filter_wp_mail_from");

Initial URL
http://premium.wpmudev.org/blog/wordpress-email-settings/

Initial Description
This is similar to [example 1](http://snipplr.com/view/77687/wordpress-change-admin-email-to-new-users/) but more portable.

Initial Title
Wordpress: Change admin email to new users (example 2)

Initial Tags
wordpress

Initial Language
JavaScript