How to change the default WordPress

If you are a WordPress site owner, you should have noticed that the default Wordpress sending email is wordpress@example.com. Moreover, the default WordPress sending name is WordPress. Someone receiving an email may not recognize the sender. In this article, we will see how to change that to default values.Most companies use noreply@example.com and the company name as the sender's Name. You can also use the general email in case you are expecting a reply. In any case, let see how to fix that.email

Changing the default Wordpress sender From email

To change the default From email to something custom, you need to use a filter that will replace wordpress@ by whatever you want. Hence, in my case, if I want my customers to know that the sender is gilblas@, then I will replace wordpress@ by gilblas@. The code below will help you to achieve that.
<?php 
/* 

Other codes in your functions.php file

*/ 

add_filter( 'wp_mail_from', 'my_mail_from' );
function my_mail_from( $email ) {
    return "gilblas@prositeweb.ca";
}

?>

Changing the default From Name

As mentioned above, the default from the Name is WordPress. And we would like to change that to the company name; let say Prositeweb or your Name. To achieve that, we will also use a function that will replace WordPress by whatever we want. The code below will help to achieve that.
<?php 

add_filter( 'wp_mail_from_name', 'my_mail_from_name' );
function my_mail_from_name( $name ) {
    return "Prositeweb Inc";
}
?>
Remarks:
  • Note that you need to add those blocks of codes in the functions.php of your active theme.
  • Do all the changes on a dev environment to avoid any error to display in the frontend
  • Always think about doing a backup before implementing new changes

Where is the functions.php file?

In case you don't know WordPress structure, there are three ways to locate the functions.php file.

Log in to your WordPress installation folder

Go to wp-content -> themes - > Your active themes - >functions.php

Use an FTP (File Transfer Protocol)

  • Navigate to wp-content -> themes ->Your active themes
  • Download the file functions.php
  • Do all the changes and,
  • import back to your active themes

Use Appearance Theme Editor

With the admin privilege, you can
  • go to Appearance -> Theme Editor
  • Open functions.php
  • Edit and save
 Thanks for reading. I hope it will help.If you like this article, you may also want to read Create a Video Channel on Your Website with YouTube APIVisit our blog for more articles. We can also subscribe to receive an email notification whenever we publish a new post. 

Do you have a project?

Please contact us directly by mail or from our contact form. You can also visit our support page which might help solve your problem.

    +1 (514) 548-3513    +1 (438) 929-5887    9590 Boul Henri-Bourassa E Bureau 108, Montréal-Est, Quebec H1E 2S4, Québec, Canada