最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Multisite - Change Add user to Blog notification email

programmeradmin1浏览0评论

When adding an existing user to a blog (in the admin panel), a very basic email is sent. I am trying to overide this email so it is a bit more attractive - to at least have a clickable link.

Looking in user-new.php, it doesn't appear to have an apply_filter.

How can I change this email without an apply_filter

The email is

You\'ve been invited to join \'%1$s\' at. 
%2$s with the role of %3$s.

Please click the following link to confirm the invite:
%4$s'

When adding an existing user to a blog (in the admin panel), a very basic email is sent. I am trying to overide this email so it is a bit more attractive - to at least have a clickable link.

Looking in user-new.php, it doesn't appear to have an apply_filter.

How can I change this email without an apply_filter

The email is

You\'ve been invited to join \'%1$s\' at. 
%2$s with the role of %3$s.

Please click the following link to confirm the invite:
%4$s'
Share Improve this question asked Mar 30, 2020 at 22:27 StripyTigerStripyTiger 2771 silver badge6 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

There's a wp_mail filter you might be able to use:

add_filter( 'wp_mail', 'wpse362824_filter_message' );
function wpse362824_filter_message( $args ) {
    // The $expected_subject is taken from the wp_mail() call
    // in user-new.php.
    $expected_subject = sprintf(
        __( '[%s] Joining confirmation' ), 
        wp_specialchars_decode( get_option( 'blogname' ) )
    );
    // If the Subject: line matches the one from user-new.php,
    // do the substitution.
    if ( $expected_subject === $args['subject'] ) {
        $args['message'] = 'Your message goes here';
    }
    return $args;
}
发布评论

评论列表(0)

  1. 暂无评论