Skip to content

Instantly share code, notes, and snippets.

@andrejIka
Created July 5, 2019 18:23
Show Gist options
  • Save andrejIka/0b3254fb423b426da964f993aeb9162c to your computer and use it in GitHub Desktop.
Save andrejIka/0b3254fb423b426da964f993aeb9162c to your computer and use it in GitHub Desktop.
Change from to wordpress email
<?php
// first
add_filter( 'wp_mail_from', 'wpse_new_mail_from' );
function wpse_new_mail_from( $old ) {
return 'your email address'; // Edit it with your email address
}
add_filter('wp_mail_from_name', 'wpse_new_mail_from_name');
function wpse_new_mail_from_name( $old ) {
return 'your name or your website'; // Edit it with your/company name
}
// second
add_filter( 'wp_mail_from', 'new_mail_from' );
add_filter( 'wp_mail_from_name', 'new_mail_from_name' );
function new_mail_from( $old ) {
return get_option( 'admin_email' );
}
function new_mail_from_name( $old ) {
return get_option( 'blogname' );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment