从 wordpress 为新用户发送的 "welcome email" 中隐藏或删除 log-in link

Hide or Remove the log-in link from the "welcome email" send by wordpress for new users

我觉得标题已经说明了一切。

我需要隐藏或删除 wordpress 在 "welcome email" 中发送给已注册的新用户的登录名 link

现在邮件包含在 用户名 密码 Link

我只需要 link 就可以了。

感谢您的帮助。

要操作新用户电子邮件,您可以覆盖 /wp-includes/pluggable.php 中的 wp_new_user_notification() 函数。由于您只能覆盖插件中的可插入功能,而不能通过 functions.php,因此您应该使用以下代码创建一个简单的插件:

<?php
/**
 * Plugin Name: Custom welcome email
 */

if ( !function_exists('wp_new_user_notification') ) :
    function wp_new_user_notification($user_id, $plaintext_pass = '') {
            $user = get_userdata( $user_id );

            $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);

            $message  = sprintf(__('New user registration on your site %s:'), $blogname) . "\r\n\r\n";
            $message .= sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n";
            $message .= sprintf(__('E-mail: %s'), $user->user_email) . "\r\n";

            @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);

            if ( empty($plaintext_pass) )
                    return;

            //$message  = sprintf(__('Username: %s'), $user->user_login) . "\r\n";
            //$message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
            $message .= wp_login_url() . "\r\n";

            wp_mail($user->user_email, sprintf(__('[%s] Your username and password'), $blogname), $message);

    }
endif;

更简单的解决方案可能是使用以下插件:link.