I have a problem with translation of WordPress blogname in email response after registering new user. Translated blogname should be in the topic of the message and in the message itself. Code presented below gives me raw output like: [:en]Sitename[:pl]Nazwa strony[:] instead of language specific version without shortcodes.


function wp_new_user_notification( $user_id, $deprecated = null, $notify = '' ) {
if ( $deprecated !== null ) {
    _deprecated_argument( __FUNCTION__, '4.3.1' );

global $wpdb, $wp_hasher;
$user = get_userdata( $user_id );

// The blogname option is escaped with esc_html on the way into the database in sanitize_option
// we want to reverse this for the plain text arena of emails.
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);

$message  = sprintf(__('New user registration on your site %s:'), $blogname) . "rnrn";
$message .= sprintf(__('Username: %s'), $user->user_login) . "rnrn";
$message .= sprintf(__('Email: %s'), $user->user_email) . "rn";

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

Read more here: qTranslateX, translating WordPress blogname returns [:en]text[:] instead of translation


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: