在什么网站可以做硬件项目,wordpress keywords不见,营销策划,有没有那个的网站wordpress在提供邮件提醒的地方都留了hook#xff0c;方便让开发者自定义。最新在添加第三方登录时遇到虚拟邮箱发信问题#xff0c;为了防止给指定邮件地址后缀发信#xff0c;可以利用如下wordpress提供的钩子来实现。 //https://www.wwttl.com/101.html
//禁止用户注册时…
wordpress在提供邮件提醒的地方都留了hook方便让开发者自定义。最新在添加第三方登录时遇到虚拟邮箱发信问题为了防止给指定邮件地址后缀发信可以利用如下wordpress提供的钩子来实现。 //https://www.wwttl.com/101.html
//禁止用户注册时发送电子邮件给管理员
add_filter( wp_new_user_notification_email_admin, __return_false );// 禁止用户重置修改密码时发送电子邮件给管理员
add_filter( wp_password_change_notification_email, __return_false );// 禁止用户注册时发送电子邮件给注册者
add_filter( wp_new_user_notification_email, __return_false );// 禁止邮箱地址改变时发送邮件给注册者
add_filter( send_email_change_email, __return_false );// 禁止更改密码时发送电子邮件给注册者
add_filter( send_password_change_email, __return_false ); 注册时过滤 //https://www.wwttl.com/101.html
// 注册时过滤有oauth.com邮箱地址发送注册邮件提醒
function filter_email_recipient( $recipient, $user ) {$email $user-user_email;$allowed_domains array( test.com );$email_parts explode( , $email );$domain end( $email_parts );if (!in_array( $domain, $allowed_domains ) ) {return $recipient;}return ;
}
add_filter( wp_new_user_notification_email, filter_email_recipient, 10, 2 ); 评论时过滤 //https://www.wwttl.com/101.html
//过滤评论发送邮件地址
function custom_comment_email_filter( $emails, $comment_id ) {$blacklisted_domains array( test.com ); $comment get_comment( $comment_id );$comment_author_email $comment-comment_author_email;$email_parts explode( , $comment_author_email );$domain end( $email_parts );if ( in_array( $domain, $blacklisted_domains ) ) {$key array_search( $comment_author_email, $emails );if ( false ! $key ) {unset( $emails[ $key ] );}}return $emails;
}
add_filter( comment_notification_recipients, custom_comment_email_filter, 10, 2 ); 将代码中的test.com换成你需要过滤的邮件地址后缀即可。 修改邮箱时过滤 //https://www.wwttl.com/101.html
// 禁止修改邮箱地址时发送确认邮件
add_filter( send_email_change_email, __return_false ); 我这里直接禁止如果想过滤可以参考上面的过滤代码 修改密码时过滤 //https://www.wwttl.com/101.html
// 禁止修改密码时发送密码重置邮件
add_filter( send_password_change_email, __return_false ); 我这里直接禁止如果想过滤可以参考上面的过滤代码