Change the from name and from email in WordPress

This is a classic, and therefore deserves a short post: changing the name and address of the sender in WordPress email sends.
By default, WordPress will use something like WordPress [email protected].
If you want to change it, and improve the user experience a little more, then I’ll show you how to do it, it’s very easy.
To change the address:
add_filter( 'wp_mail_from', 'change_mail_from', 10, 1 );
function change_mail_from( $old ) {
return '[email protected]';
}
To change the name:
add_filter( 'wp_mail_from_name', 'change_mail_from_name', 10, 1 );
function change_mail_from_name( $old ) {
return 'My Site';
}
Ready, with this you can change these parameters.
Remember, a good place to put these snippets is in the functions.php of your theme or child theme.