Change Default WordPress 'From' Field in Emails


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. if ( !class_exists('wp_mail_from') ) {
  2. class wp_mail_from {
  3. function wp_mail_from() {
  4. add_filter( 'wp_mail_from', array(&$this, 'fb_mail_from') );
  5. add_filter( 'wp_mail_from_name', array(&$this, 'fb_mail_from_name') );
  6. }
  7. // new name
  8. function fb_mail_from_name() {
  9. $name = 'Put the Name Here';
  10. // alternative the name of the blog
  11. // $name = get_option('blogname');
  12. $name = esc_attr($name);
  13. return $name;
  14. }
  15. // new email-adress
  16. function fb_mail_from() {
  17. $email = '[email protected]';
  18. $email = is_email($email);
  19. return $email;
  20. }
  21. }
  22. $wp_mail_from = new wp_mail_from();
  23. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.