How to disable all WordPress emails modularly and programatically?

Option 1: Remove the ‘to’ argument from wp_mail function in WordPress, it will keep your system running without sending any default WordPress emails. add_filter(‘wp_mail’,’disabling_emails’, 10,1); function disabling_emails( $args ){ unset ( $args[‘to’] ); return $args; } The wp_mail is a wrapper for the phpmailer class and it will not send any emails if there is … Read more

Turn off admin emails for new user registrations

Function wp_new_user_notification is pluggable. It means that you can override it by declaring your version of this function in your plugin/theme. So, if you wish to disable all notifications completely, do it like this: if ( !function_exists( ‘wp_new_user_notification’ ) ) : function wp_new_user_notification( $user_id, $plaintext_pass=”” ) { return; } endif; However I wouldn’t recommend you … Read more

wp_mail – Remove sitename from email subject

Finally, I wrote some code and it worked very well. I hope it helps. Put this in your functions.php file //remove sitename from email subject add_filter(‘wp_mail’, ’email_subject_remove_sitename’); function email_subject_remove_sitename($email) { $blogname = wp_specialchars_decode(get_option(‘blogname’), ENT_QUOTES); $email[‘subject’] = str_replace(“[“.$blogname.”] – “, “”, $email[‘subject’]); $email[‘subject’] = str_replace(“[“.$blogname.”]”, “”, $email[‘subject’]); return $email; }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)