Change From Name Email
November 25, 2024 · AI Conversations
Here’s an example code snippet you can add to your theme’s `functions.php` file or a custom plugin:
// Change the "From Email" address
add_filter('wp_mail_from', function($original_email_address) {
return 'your-email@example.com'; // Replace with your desired email address
});
// Change the "From Name"
add_filter('wp_mail_from_name', function($original_email_from) {
return 'Your Custom Name'; // Replace with your desired name
});
### Explanation:
– **`wp_mail_from`**: Filters the email address used as the sender.
– **`wp_mail_from_name`**: Filters the name associated with the sender email.
### Notes:
1. Replace `your-email@example.com` and `Your Custom Name` with the desired values.
2. Ensure the email address you use is from a verified domain, especially if you're using an external SMTP server, to avoid deliverability issues.
3. If you're using a plugin to send emails (e.g., WP Mail SMTP), it might override these filters. Check your plugin settings for conflicts.
Would you like help integrating this with a custom plugin or specific functionality?