wp_send_user_request

The timeline below displays how wordpress function wp_send_user_request has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.2

/**
 * Send a confirmation request email to confirm an action.
 *
 * If the request is not already pending, it will be updated.
 *
 * @since 4.9.6
 *
 * @param string $request_id ID of the request created via wp_create_user_request().
 * @return true|WP_Error True on success, `WP_Error` on failure.
 */
function wp_send_user_request($request_id)
{
    $request_id = absint($request_id);
    $request = wp_get_user_request($request_id);
    if (!$request) {
        return new WP_Error('invalid_request', __('Invalid personal data request.'));
    }
    // Localize message content for user; fallback to site default for visitors.
    if (!empty($request->user_id)) {
        $switched_locale = switch_to_user_locale($request->user_id);
    } else {
        $switched_locale = switch_to_locale(get_locale());
    }
    $email_data = array('request' => $request, 'email' => $request->email, 'description' => wp_user_request_action_description($request->action_name), 'confirm_url' => add_query_arg(array('action' => 'confirmaction', 'request_id' => $request_id, 'confirm_key' => wp_generate_user_request_key($request_id)), wp_login_url()), 'sitename' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), 'siteurl' => home_url());
    /* translators: Confirm privacy data request notification email subject. 1: Site title, 2: Name of the action. */
    $subject = sprintf(__('[%1$s] Confirm Action: %2$s'), $email_data['sitename'], $email_data['description']);
    /**
     * Filters the subject of the email sent when an account action is attempted.
     *
     * @since 4.9.6
     *
     * @param string $subject    The email subject.
     * @param string $sitename   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $subject = apply_filters('user_request_action_email_subject', $subject, $email_data['sitename'], $email_data);
    /* translators: Do not translate DESCRIPTION, CONFIRM_URL, SITENAME, SITEURL: those are placeholders. */
    $content = __('Howdy,

A request has been made to perform the following action on your account:

     ###DESCRIPTION###

To confirm this, please click on the following link:
###CONFIRM_URL###

You can safely ignore and delete this email if you do not want to
take this action.

Regards,
All at ###SITENAME###
###SITEURL###');
    /**
     * Filters the text of the email sent when an account action is attempted.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###DESCRIPTION### Description of the action being performed so the user knows what the email is for.
     * ###CONFIRM_URL### The link to click on to confirm the account action.
     * ###SITENAME###    The name of the site.
     * ###SITEURL###     The URL to the site.
     *
     * @since 4.9.6
     *
     * @param string $content Text in the email.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $content = apply_filters('user_request_action_email_content', $content, $email_data);
    $content = str_replace('###DESCRIPTION###', $email_data['description'], $content);
    $content = str_replace('###CONFIRM_URL###', sanitize_url($email_data['confirm_url']), $content);
    $content = str_replace('###EMAIL###', $email_data['email'], $content);
    $content = str_replace('###SITENAME###', $email_data['sitename'], $content);
    $content = str_replace('###SITEURL###', sanitize_url($email_data['siteurl']), $content);
    $headers = '';
    /**
     * Filters the headers of the email sent when an account action is attempted.
     *
     * @since 5.4.0
     *
     * @param string|array $headers    The email headers.
     * @param string       $subject    The email subject.
     * @param string       $content    The email content.
     * @param int          $request_id The request ID.
     * @param array        $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $headers = apply_filters('user_request_action_email_headers', $headers, $subject, $content, $request_id, $email_data);
    $email_sent = wp_mail($email_data['email'], $subject, $content, $headers);
    if ($switched_locale) {
        restore_previous_locale();
    }
    if (!$email_sent) {
        return new WP_Error('privacy_email_error', __('Unable to send personal data export confirmation email.'));
    }
    return true;
}

WordPress Version: 6.1

/**
 * Send a confirmation request email to confirm an action.
 *
 * If the request is not already pending, it will be updated.
 *
 * @since 4.9.6
 *
 * @param string $request_id ID of the request created via wp_create_user_request().
 * @return true|WP_Error True on success, `WP_Error` on failure.
 */
function wp_send_user_request($request_id)
{
    $request_id = absint($request_id);
    $request = wp_get_user_request($request_id);
    if (!$request) {
        return new WP_Error('invalid_request', __('Invalid personal data request.'));
    }
    // Localize message content for user; fallback to site default for visitors.
    if (!empty($request->user_id)) {
        $locale = get_user_locale($request->user_id);
    } else {
        $locale = get_locale();
    }
    $switched_locale = switch_to_locale($locale);
    $email_data = array('request' => $request, 'email' => $request->email, 'description' => wp_user_request_action_description($request->action_name), 'confirm_url' => add_query_arg(array('action' => 'confirmaction', 'request_id' => $request_id, 'confirm_key' => wp_generate_user_request_key($request_id)), wp_login_url()), 'sitename' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), 'siteurl' => home_url());
    /* translators: Confirm privacy data request notification email subject. 1: Site title, 2: Name of the action. */
    $subject = sprintf(__('[%1$s] Confirm Action: %2$s'), $email_data['sitename'], $email_data['description']);
    /**
     * Filters the subject of the email sent when an account action is attempted.
     *
     * @since 4.9.6
     *
     * @param string $subject    The email subject.
     * @param string $sitename   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $subject = apply_filters('user_request_action_email_subject', $subject, $email_data['sitename'], $email_data);
    /* translators: Do not translate DESCRIPTION, CONFIRM_URL, SITENAME, SITEURL: those are placeholders. */
    $content = __('Howdy,

A request has been made to perform the following action on your account:

     ###DESCRIPTION###

To confirm this, please click on the following link:
###CONFIRM_URL###

You can safely ignore and delete this email if you do not want to
take this action.

Regards,
All at ###SITENAME###
###SITEURL###');
    /**
     * Filters the text of the email sent when an account action is attempted.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###DESCRIPTION### Description of the action being performed so the user knows what the email is for.
     * ###CONFIRM_URL### The link to click on to confirm the account action.
     * ###SITENAME###    The name of the site.
     * ###SITEURL###     The URL to the site.
     *
     * @since 4.9.6
     *
     * @param string $content Text in the email.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $content = apply_filters('user_request_action_email_content', $content, $email_data);
    $content = str_replace('###DESCRIPTION###', $email_data['description'], $content);
    $content = str_replace('###CONFIRM_URL###', sanitize_url($email_data['confirm_url']), $content);
    $content = str_replace('###EMAIL###', $email_data['email'], $content);
    $content = str_replace('###SITENAME###', $email_data['sitename'], $content);
    $content = str_replace('###SITEURL###', sanitize_url($email_data['siteurl']), $content);
    $headers = '';
    /**
     * Filters the headers of the email sent when an account action is attempted.
     *
     * @since 5.4.0
     *
     * @param string|array $headers    The email headers.
     * @param string       $subject    The email subject.
     * @param string       $content    The email content.
     * @param int          $request_id The request ID.
     * @param array        $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $headers = apply_filters('user_request_action_email_headers', $headers, $subject, $content, $request_id, $email_data);
    $email_sent = wp_mail($email_data['email'], $subject, $content, $headers);
    if ($switched_locale) {
        restore_previous_locale();
    }
    if (!$email_sent) {
        return new WP_Error('privacy_email_error', __('Unable to send personal data export confirmation email.'));
    }
    return true;
}

WordPress Version: 5.8

/**
 * Send a confirmation request email to confirm an action.
 *
 * If the request is not already pending, it will be updated.
 *
 * @since 4.9.6
 *
 * @param string $request_id ID of the request created via wp_create_user_request().
 * @return true|WP_Error True on success, `WP_Error` on failure.
 */
function wp_send_user_request($request_id)
{
    $request_id = absint($request_id);
    $request = wp_get_user_request($request_id);
    if (!$request) {
        return new WP_Error('invalid_request', __('Invalid personal data request.'));
    }
    // Localize message content for user; fallback to site default for visitors.
    if (!empty($request->user_id)) {
        $locale = get_user_locale($request->user_id);
    } else {
        $locale = get_locale();
    }
    $switched_locale = switch_to_locale($locale);
    $email_data = array('request' => $request, 'email' => $request->email, 'description' => wp_user_request_action_description($request->action_name), 'confirm_url' => add_query_arg(array('action' => 'confirmaction', 'request_id' => $request_id, 'confirm_key' => wp_generate_user_request_key($request_id)), wp_login_url()), 'sitename' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), 'siteurl' => home_url());
    /* translators: Confirm privacy data request notification email subject. 1: Site title, 2: Name of the action. */
    $subject = sprintf(__('[%1$s] Confirm Action: %2$s'), $email_data['sitename'], $email_data['description']);
    /**
     * Filters the subject of the email sent when an account action is attempted.
     *
     * @since 4.9.6
     *
     * @param string $subject    The email subject.
     * @param string $sitename   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $subject = apply_filters('user_request_action_email_subject', $subject, $email_data['sitename'], $email_data);
    /* translators: Do not translate DESCRIPTION, CONFIRM_URL, SITENAME, SITEURL: those are placeholders. */
    $content = __('Howdy,

A request has been made to perform the following action on your account:

     ###DESCRIPTION###

To confirm this, please click on the following link:
###CONFIRM_URL###

You can safely ignore and delete this email if you do not want to
take this action.

Regards,
All at ###SITENAME###
###SITEURL###');
    /**
     * Filters the text of the email sent when an account action is attempted.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###DESCRIPTION### Description of the action being performed so the user knows what the email is for.
     * ###CONFIRM_URL### The link to click on to confirm the account action.
     * ###SITENAME###    The name of the site.
     * ###SITEURL###     The URL to the site.
     *
     * @since 4.9.6
     *
     * @param string $content Text in the email.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $content = apply_filters('user_request_action_email_content', $content, $email_data);
    $content = str_replace('###DESCRIPTION###', $email_data['description'], $content);
    $content = str_replace('###CONFIRM_URL###', esc_url_raw($email_data['confirm_url']), $content);
    $content = str_replace('###EMAIL###', $email_data['email'], $content);
    $content = str_replace('###SITENAME###', $email_data['sitename'], $content);
    $content = str_replace('###SITEURL###', esc_url_raw($email_data['siteurl']), $content);
    $headers = '';
    /**
     * Filters the headers of the email sent when an account action is attempted.
     *
     * @since 5.4.0
     *
     * @param string|array $headers    The email headers.
     * @param string       $subject    The email subject.
     * @param string       $content    The email content.
     * @param int          $request_id The request ID.
     * @param array        $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $headers = apply_filters('user_request_action_email_headers', $headers, $subject, $content, $request_id, $email_data);
    $email_sent = wp_mail($email_data['email'], $subject, $content, $headers);
    if ($switched_locale) {
        restore_previous_locale();
    }
    if (!$email_sent) {
        return new WP_Error('privacy_email_error', __('Unable to send personal data export confirmation email.'));
    }
    return true;
}

WordPress Version: 5.7

/**
 * Send a confirmation request email to confirm an action.
 *
 * If the request is not already pending, it will be updated.
 *
 * @since 4.9.6
 *
 * @param string $request_id ID of the request created via wp_create_user_request().
 * @return true|WP_Error True on success, `WP_Error` on failure.
 */
function wp_send_user_request($request_id)
{
    $request_id = absint($request_id);
    $request = wp_get_user_request($request_id);
    if (!$request) {
        return new WP_Error('invalid_request', __('Invalid personal data request.'));
    }
    // Localize message content for user; fallback to site default for visitors.
    if (!empty($request->user_id)) {
        $locale = get_user_locale($request->user_id);
    } else {
        $locale = get_locale();
    }
    $switched_locale = switch_to_locale($locale);
    $email_data = array('request' => $request, 'email' => $request->email, 'description' => wp_user_request_action_description($request->action_name), 'confirm_url' => add_query_arg(array('action' => 'confirmaction', 'request_id' => $request_id, 'confirm_key' => wp_generate_user_request_key($request_id)), wp_login_url()), 'sitename' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), 'siteurl' => home_url());
    /* translators: Do not translate DESCRIPTION, CONFIRM_URL, SITENAME, SITEURL: those are placeholders. */
    $email_text = __('Howdy,

A request has been made to perform the following action on your account:

     ###DESCRIPTION###

To confirm this, please click on the following link:
###CONFIRM_URL###

You can safely ignore and delete this email if you do not want to
take this action.

Regards,
All at ###SITENAME###
###SITEURL###');
    /**
     * Filters the text of the email sent when an account action is attempted.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###DESCRIPTION### Description of the action being performed so the user knows what the email is for.
     * ###CONFIRM_URL### The link to click on to confirm the account action.
     * ###SITENAME###    The name of the site.
     * ###SITEURL###     The URL to the site.
     *
     * @since 4.9.6
     *
     * @param string $email_text Text in the email.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $content = apply_filters('user_request_action_email_content', $email_text, $email_data);
    $content = str_replace('###DESCRIPTION###', $email_data['description'], $content);
    $content = str_replace('###CONFIRM_URL###', esc_url_raw($email_data['confirm_url']), $content);
    $content = str_replace('###EMAIL###', $email_data['email'], $content);
    $content = str_replace('###SITENAME###', $email_data['sitename'], $content);
    $content = str_replace('###SITEURL###', esc_url_raw($email_data['siteurl']), $content);
    /* translators: Confirm privacy data request notification email subject. 1: Site title, 2: Name of the action. */
    $subject = sprintf(__('[%1$s] Confirm Action: %2$s'), $email_data['sitename'], $email_data['description']);
    /**
     * Filters the subject of the email sent when an account action is attempted.
     *
     * @since 4.9.6
     *
     * @param string $subject    The email subject.
     * @param string $sitename   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $subject = apply_filters('user_request_action_email_subject', $subject, $email_data['sitename'], $email_data);
    $headers = '';
    /**
     * Filters the headers of the email sent when an account action is attempted.
     *
     * @since 5.4.0
     *
     * @param string|array $headers    The email headers.
     * @param string       $subject    The email subject.
     * @param string       $content    The email content.
     * @param int          $request_id The request ID.
     * @param array        $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $headers = apply_filters('user_request_action_email_headers', $headers, $subject, $content, $request_id, $email_data);
    $email_sent = wp_mail($email_data['email'], $subject, $content, $headers);
    if ($switched_locale) {
        restore_previous_locale();
    }
    if (!$email_sent) {
        return new WP_Error('privacy_email_error', __('Unable to send personal data export confirmation email.'));
    }
    return true;
}

WordPress Version: 5.6

/**
 * Send a confirmation request email to confirm an action.
 *
 * If the request is not already pending, it will be updated.
 *
 * @since 4.9.6
 *
 * @param string $request_id ID of the request created via wp_create_user_request().
 * @return bool|WP_Error True on success, `WP_Error` on failure.
 */
function wp_send_user_request($request_id)
{
    $request_id = absint($request_id);
    $request = wp_get_user_request($request_id);
    if (!$request) {
        return new WP_Error('invalid_request', __('Invalid user privacy request.'));
    }
    // Localize message content for user; fallback to site default for visitors.
    if (!empty($request->user_id)) {
        $locale = get_user_locale($request->user_id);
    } else {
        $locale = get_locale();
    }
    $switched_locale = switch_to_locale($locale);
    $email_data = array('request' => $request, 'email' => $request->email, 'description' => wp_user_request_action_description($request->action_name), 'confirm_url' => add_query_arg(array('action' => 'confirmaction', 'request_id' => $request_id, 'confirm_key' => wp_generate_user_request_key($request_id)), wp_login_url()), 'sitename' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), 'siteurl' => home_url());
    /* translators: Do not translate DESCRIPTION, CONFIRM_URL, SITENAME, SITEURL: those are placeholders. */
    $email_text = __('Howdy,

A request has been made to perform the following action on your account:

     ###DESCRIPTION###

To confirm this, please click on the following link:
###CONFIRM_URL###

You can safely ignore and delete this email if you do not want to
take this action.

Regards,
All at ###SITENAME###
###SITEURL###');
    /**
     * Filters the text of the email sent when an account action is attempted.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###DESCRIPTION### Description of the action being performed so the user knows what the email is for.
     * ###CONFIRM_URL### The link to click on to confirm the account action.
     * ###SITENAME###    The name of the site.
     * ###SITEURL###     The URL to the site.
     *
     * @since 4.9.6
     *
     * @param string $email_text Text in the email.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $content = apply_filters('user_request_action_email_content', $email_text, $email_data);
    $content = str_replace('###DESCRIPTION###', $email_data['description'], $content);
    $content = str_replace('###CONFIRM_URL###', esc_url_raw($email_data['confirm_url']), $content);
    $content = str_replace('###EMAIL###', $email_data['email'], $content);
    $content = str_replace('###SITENAME###', $email_data['sitename'], $content);
    $content = str_replace('###SITEURL###', esc_url_raw($email_data['siteurl']), $content);
    /* translators: Confirm privacy data request notification email subject. 1: Site title, 2: Name of the action. */
    $subject = sprintf(__('[%1$s] Confirm Action: %2$s'), $email_data['sitename'], $email_data['description']);
    /**
     * Filters the subject of the email sent when an account action is attempted.
     *
     * @since 4.9.6
     *
     * @param string $subject    The email subject.
     * @param string $sitename   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $subject = apply_filters('user_request_action_email_subject', $subject, $email_data['sitename'], $email_data);
    $headers = '';
    /**
     * Filters the headers of the email sent when an account action is attempted.
     *
     * @since 5.4.0
     *
     * @param string|array $headers    The email headers.
     * @param string       $subject    The email subject.
     * @param string       $content    The email content.
     * @param int          $request_id The request ID.
     * @param array        $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $headers = apply_filters('user_request_action_email_headers', $headers, $subject, $content, $request_id, $email_data);
    $email_sent = wp_mail($email_data['email'], $subject, $content, $headers);
    if ($switched_locale) {
        restore_previous_locale();
    }
    if (!$email_sent) {
        return new WP_Error('privacy_email_error', __('Unable to send personal data export confirmation email.'));
    }
    return true;
}

WordPress Version: 5.4

/**
 * Send a confirmation request email to confirm an action.
 *
 * If the request is not already pending, it will be updated.
 *
 * @since 4.9.6
 *
 * @param string $request_id ID of the request created via wp_create_user_request().
 * @return bool|WP_Error True on success, `WP_Error` on failure.
 */
function wp_send_user_request($request_id)
{
    $request_id = absint($request_id);
    $request = wp_get_user_request($request_id);
    if (!$request) {
        return new WP_Error('invalid_request', __('Invalid user request.'));
    }
    // Localize message content for user; fallback to site default for visitors.
    if (!empty($request->user_id)) {
        $locale = get_user_locale($request->user_id);
    } else {
        $locale = get_locale();
    }
    $switched_locale = switch_to_locale($locale);
    $email_data = array('request' => $request, 'email' => $request->email, 'description' => wp_user_request_action_description($request->action_name), 'confirm_url' => add_query_arg(array('action' => 'confirmaction', 'request_id' => $request_id, 'confirm_key' => wp_generate_user_request_key($request_id)), wp_login_url()), 'sitename' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), 'siteurl' => home_url());
    /* translators: Do not translate DESCRIPTION, CONFIRM_URL, SITENAME, SITEURL: those are placeholders. */
    $email_text = __('Howdy,

A request has been made to perform the following action on your account:

     ###DESCRIPTION###

To confirm this, please click on the following link:
###CONFIRM_URL###

You can safely ignore and delete this email if you do not want to
take this action.

Regards,
All at ###SITENAME###
###SITEURL###');
    /**
     * Filters the text of the email sent when an account action is attempted.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###DESCRIPTION### Description of the action being performed so the user knows what the email is for.
     * ###CONFIRM_URL### The link to click on to confirm the account action.
     * ###SITENAME###    The name of the site.
     * ###SITEURL###     The URL to the site.
     *
     * @since 4.9.6
     *
     * @param string $email_text Text in the email.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $content = apply_filters('user_request_action_email_content', $email_text, $email_data);
    $content = str_replace('###DESCRIPTION###', $email_data['description'], $content);
    $content = str_replace('###CONFIRM_URL###', esc_url_raw($email_data['confirm_url']), $content);
    $content = str_replace('###EMAIL###', $email_data['email'], $content);
    $content = str_replace('###SITENAME###', $email_data['sitename'], $content);
    $content = str_replace('###SITEURL###', esc_url_raw($email_data['siteurl']), $content);
    /* translators: Confirm privacy data request notification email subject. 1: Site title, 2: Name of the action. */
    $subject = sprintf(__('[%1$s] Confirm Action: %2$s'), $email_data['sitename'], $email_data['description']);
    /**
     * Filters the subject of the email sent when an account action is attempted.
     *
     * @since 4.9.6
     *
     * @param string $subject    The email subject.
     * @param string $sitename   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $subject = apply_filters('user_request_action_email_subject', $subject, $email_data['sitename'], $email_data);
    $headers = '';
    /**
     * Filters the headers of the email sent when an account action is attempted.
     *
     * @since 5.4.0
     *
     * @param string|array $headers    The email headers.
     * @param string       $subject    The email subject.
     * @param string       $content    The email content.
     * @param int          $request_id The request ID.
     * @param array        $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $headers = apply_filters('user_request_action_email_headers', $headers, $subject, $content, $request_id, $email_data);
    $email_sent = wp_mail($email_data['email'], $subject, $content, $headers);
    if ($switched_locale) {
        restore_previous_locale();
    }
    if (!$email_sent) {
        return new WP_Error('privacy_email_error', __('Unable to send personal data export confirmation email.'));
    }
    return true;
}

WordPress Version: 5.3

/**
 * Send a confirmation request email to confirm an action.
 *
 * If the request is not already pending, it will be updated.
 *
 * @since 4.9.6
 *
 * @param string $request_id ID of the request created via wp_create_user_request().
 * @return bool|WP_Error True on success, `WP_Error` on failure.
 */
function wp_send_user_request($request_id)
{
    $request_id = absint($request_id);
    $request = wp_get_user_request_data($request_id);
    if (!$request) {
        return new WP_Error('invalid_request', __('Invalid user request.'));
    }
    // Localize message content for user; fallback to site default for visitors.
    if (!empty($request->user_id)) {
        $locale = get_user_locale($request->user_id);
    } else {
        $locale = get_locale();
    }
    $switched_locale = switch_to_locale($locale);
    $email_data = array('request' => $request, 'email' => $request->email, 'description' => wp_user_request_action_description($request->action_name), 'confirm_url' => add_query_arg(array('action' => 'confirmaction', 'request_id' => $request_id, 'confirm_key' => wp_generate_user_request_key($request_id)), wp_login_url()), 'sitename' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), 'siteurl' => home_url());
    /* translators: Do not translate DESCRIPTION, CONFIRM_URL, SITENAME, SITEURL: those are placeholders. */
    $email_text = __('Howdy,

A request has been made to perform the following action on your account:

     ###DESCRIPTION###

To confirm this, please click on the following link:
###CONFIRM_URL###

You can safely ignore and delete this email if you do not want to
take this action.

Regards,
All at ###SITENAME###
###SITEURL###');
    /**
     * Filters the text of the email sent when an account action is attempted.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###DESCRIPTION### Description of the action being performed so the user knows what the email is for.
     * ###CONFIRM_URL### The link to click on to confirm the account action.
     * ###SITENAME###    The name of the site.
     * ###SITEURL###     The URL to the site.
     *
     * @since 4.9.6
     *
     * @param string $email_text Text in the email.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $content = apply_filters('user_request_action_email_content', $email_text, $email_data);
    $content = str_replace('###DESCRIPTION###', $email_data['description'], $content);
    $content = str_replace('###CONFIRM_URL###', esc_url_raw($email_data['confirm_url']), $content);
    $content = str_replace('###EMAIL###', $email_data['email'], $content);
    $content = str_replace('###SITENAME###', $email_data['sitename'], $content);
    $content = str_replace('###SITEURL###', esc_url_raw($email_data['siteurl']), $content);
    /* translators: Confirm privacy data request notification email subject. 1: Site title, 2: Name of the action. */
    $subject = sprintf(__('[%1$s] Confirm Action: %2$s'), $email_data['sitename'], $email_data['description']);
    /**
     * Filters the subject of the email sent when an account action is attempted.
     *
     * @since 4.9.6
     *
     * @param string $subject    The email subject.
     * @param string $sitename   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $subject = apply_filters('user_request_action_email_subject', $subject, $email_data['sitename'], $email_data);
    $email_sent = wp_mail($email_data['email'], $subject, $content);
    if ($switched_locale) {
        restore_previous_locale();
    }
    if (!$email_sent) {
        return new WP_Error('privacy_email_error', __('Unable to send personal data export confirmation email.'));
    }
    return true;
}

WordPress Version: 5.2

/**
 * Send a confirmation request email to confirm an action.
 *
 * If the request is not already pending, it will be updated.
 *
 * @since 4.9.6
 *
 * @param string $request_id ID of the request created via wp_create_user_request().
 * @return bool|WP_Error True on success, `WP_Error` on failure.
 */
function wp_send_user_request($request_id)
{
    $request_id = absint($request_id);
    $request = wp_get_user_request_data($request_id);
    if (!$request) {
        return new WP_Error('invalid_request', __('Invalid user request.'));
    }
    // Localize message content for user; fallback to site default for visitors.
    if (!empty($request->user_id)) {
        $locale = get_user_locale($request->user_id);
    } else {
        $locale = get_locale();
    }
    $switched_locale = switch_to_locale($locale);
    $email_data = array('request' => $request, 'email' => $request->email, 'description' => wp_user_request_action_description($request->action_name), 'confirm_url' => add_query_arg(array('action' => 'confirmaction', 'request_id' => $request_id, 'confirm_key' => wp_generate_user_request_key($request_id)), wp_login_url()), 'sitename' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), 'siteurl' => home_url());
    /* translators: Do not translate DESCRIPTION, CONFIRM_URL, SITENAME, SITEURL: those are placeholders. */
    $email_text = __('Howdy,

A request has been made to perform the following action on your account:

     ###DESCRIPTION###

To confirm this, please click on the following link:
###CONFIRM_URL###

You can safely ignore and delete this email if you do not want to
take this action.

Regards,
All at ###SITENAME###
###SITEURL###');
    /**
     * Filters the text of the email sent when an account action is attempted.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###DESCRIPTION### Description of the action being performed so the user knows what the email is for.
     * ###CONFIRM_URL### The link to click on to confirm the account action.
     * ###SITENAME###    The name of the site.
     * ###SITEURL###     The URL to the site.
     *
     * @since 4.9.6
     *
     * @param string $email_text Text in the email.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $content = apply_filters('user_request_action_email_content', $email_text, $email_data);
    $content = str_replace('###DESCRIPTION###', $email_data['description'], $content);
    $content = str_replace('###CONFIRM_URL###', esc_url_raw($email_data['confirm_url']), $content);
    $content = str_replace('###EMAIL###', $email_data['email'], $content);
    $content = str_replace('###SITENAME###', $email_data['sitename'], $content);
    $content = str_replace('###SITEURL###', esc_url_raw($email_data['siteurl']), $content);
    /* translators: Confirm privacy data request notification email subject. 1: Site title, 2: Name of the action */
    $subject = sprintf(__('[%1$s] Confirm Action: %2$s'), $email_data['sitename'], $email_data['description']);
    /**
     * Filters the subject of the email sent when an account action is attempted.
     *
     * @since 4.9.6
     *
     * @param string $subject    The email subject.
     * @param string $sitename   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $subject = apply_filters('user_request_action_email_subject', $subject, $email_data['sitename'], $email_data);
    $email_sent = wp_mail($email_data['email'], $subject, $content);
    if ($switched_locale) {
        restore_previous_locale();
    }
    if (!$email_sent) {
        return new WP_Error('privacy_email_error', __('Unable to send personal data export confirmation email.'));
    }
    return true;
}

WordPress Version: 5.1

/**
 * Send a confirmation request email to confirm an action.
 *
 * If the request is not already pending, it will be updated.
 *
 * @since 4.9.6
 *
 * @param string $request_id ID of the request created via wp_create_user_request().
 * @return bool|WP_Error True on success, `WP_Error` on failure.
 */
function wp_send_user_request($request_id)
{
    $request_id = absint($request_id);
    $request = wp_get_user_request_data($request_id);
    if (!$request) {
        return new WP_Error('invalid_request', __('Invalid user request.'));
    }
    // Localize message content for user; fallback to site default for visitors.
    if (!empty($request->user_id)) {
        $locale = get_user_locale($request->user_id);
    } else {
        $locale = get_locale();
    }
    $switched_locale = switch_to_locale($locale);
    $email_data = array('request' => $request, 'email' => $request->email, 'description' => wp_user_request_action_description($request->action_name), 'confirm_url' => add_query_arg(array('action' => 'confirmaction', 'request_id' => $request_id, 'confirm_key' => wp_generate_user_request_key($request_id)), wp_login_url()), 'sitename' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), 'siteurl' => home_url());
    /* translators: Do not translate DESCRIPTION, CONFIRM_URL, SITENAME, SITEURL: those are placeholders. */
    $email_text = __('Howdy,

A request has been made to perform the following action on your account:

     ###DESCRIPTION###

To confirm this, please click on the following link:
###CONFIRM_URL###

You can safely ignore and delete this email if you do not want to
take this action.

Regards,
All at ###SITENAME###
###SITEURL###');
    /**
     * Filters the text of the email sent when an account action is attempted.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###DESCRIPTION### Description of the action being performed so the user knows what the email is for.
     * ###CONFIRM_URL### The link to click on to confirm the account action.
     * ###SITENAME###    The name of the site.
     * ###SITEURL###     The URL to the site.
     *
     * @since 4.9.6
     *
     * @param string $email_text Text in the email.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $content = apply_filters('user_request_action_email_content', $email_text, $email_data);
    $content = str_replace('###DESCRIPTION###', $email_data['description'], $content);
    $content = str_replace('###CONFIRM_URL###', esc_url_raw($email_data['confirm_url']), $content);
    $content = str_replace('###EMAIL###', $email_data['email'], $content);
    $content = str_replace('###SITENAME###', $email_data['sitename'], $content);
    $content = str_replace('###SITEURL###', esc_url_raw($email_data['siteurl']), $content);
    /* translators: Privacy data request subject. 1: Site name, 2: Name of the action */
    $subject = sprintf(__('[%1$s] Confirm Action: %2$s'), $email_data['sitename'], $email_data['description']);
    /**
     * Filters the subject of the email sent when an account action is attempted.
     *
     * @since 4.9.6
     *
     * @param string $subject    The email subject.
     * @param string $sitename   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $subject = apply_filters('user_request_action_email_subject', $subject, $email_data['sitename'], $email_data);
    $email_sent = wp_mail($email_data['email'], $subject, $content);
    if ($switched_locale) {
        restore_previous_locale();
    }
    if (!$email_sent) {
        return new WP_Error('privacy_email_error', __('Unable to send personal data export confirmation email.'));
    }
    return true;
}

WordPress Version: 9.8

/**
 * Send a confirmation request email to confirm an action.
 *
 * If the request is not already pending, it will be updated.
 *
 * @since 4.9.6
 *
 * @param string $request_id ID of the request created via wp_create_user_request().
 * @return WP_Error|bool Will return true/false based on the success of sending the email, or a WP_Error object.
 */
function wp_send_user_request($request_id)
{
    $request_id = absint($request_id);
    $request = wp_get_user_request_data($request_id);
    if (!$request) {
        return new WP_Error('user_request_error', __('Invalid request.'));
    }
    $email_data = array('request' => $request, 'email' => $request->email, 'description' => wp_user_request_action_description($request->action_name), 'confirm_url' => add_query_arg(array('action' => 'confirmaction', 'request_id' => $request_id, 'confirm_key' => wp_generate_user_request_key($request_id)), wp_login_url()), 'sitename' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), 'siteurl' => home_url());
    /* translators: Do not translate DESCRIPTION, CONFIRM_URL, SITENAME, SITEURL: those are placeholders. */
    $email_text = __('Howdy,

A request has been made to perform the following action on your account:

     ###DESCRIPTION###

To confirm this, please click on the following link:
###CONFIRM_URL###

You can safely ignore and delete this email if you do not want to
take this action.

Regards,
All at ###SITENAME###
###SITEURL###');
    /**
     * Filters the text of the email sent when an account action is attempted.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###DESCRIPTION### Description of the action being performed so the user knows what the email is for.
     * ###CONFIRM_URL### The link to click on to confirm the account action.
     * ###SITENAME###    The name of the site.
     * ###SITEURL###     The URL to the site.
     *
     * @since 4.9.6
     *
     * @param string $email_text Text in the email.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $content = apply_filters('user_request_action_email_content', $email_text, $email_data);
    $content = str_replace('###DESCRIPTION###', $email_data['description'], $content);
    $content = str_replace('###CONFIRM_URL###', esc_url_raw($email_data['confirm_url']), $content);
    $content = str_replace('###EMAIL###', $email_data['email'], $content);
    $content = str_replace('###SITENAME###', $email_data['sitename'], $content);
    $content = str_replace('###SITEURL###', esc_url_raw($email_data['siteurl']), $content);
    /* translators: Privacy data request subject. 1: Site name, 2: Name of the action */
    $subject = sprintf(__('[%1$s] Confirm Action: %2$s'), $email_data['sitename'], $email_data['description']);
    /**
     * Filters the subject of the email sent when an account action is attempted.
     *
     * @since 4.9.6
     *
     * @param string $subject    The email subject.
     * @param string $sitename   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $subject = apply_filters('user_request_action_email_subject', $subject, $email_data['sitename'], $email_data);
    return wp_mail($email_data['email'], $subject, $content);
}

WordPress Version: 9.7

/**
 * Send a confirmation request email to confirm an action.
 *
 * If the request is not already pending, it will be updated.
 *
 * @since 4.9.6
 *
 * @param string $request_id ID of the request created via wp_create_user_request().
 * @return WP_Error|bool Will return true/false based on the success of sending the email, or a WP_Error object.
 */
function wp_send_user_request($request_id)
{
    $request_id = absint($request_id);
    $request = wp_get_user_request_data($request_id);
    if (!$request) {
        return new WP_Error('user_request_error', __('Invalid request.'));
    }
    $email_data = array('email' => $request->email, 'description' => wp_user_request_action_description($request->action_name), 'confirm_url' => add_query_arg(array('action' => 'confirmaction', 'request_id' => $request_id, 'confirm_key' => wp_generate_user_request_key($request_id)), site_url('wp-login.php')), 'sitename' => is_multisite() ? get_site_option('site_name') : get_option('blogname'), 'siteurl' => network_home_url());
    /* translators: Do not translate DESCRIPTION, CONFIRM_URL, SITENAME, SITEURL: those are placeholders. */
    $email_text = __('Howdy,

A request has been made to perform the following action on your account:

     ###DESCRIPTION###

To confirm this, please click on the following link:
###CONFIRM_URL###

You can safely ignore and delete this email if you do not want to
take this action.

Regards,
All at ###SITENAME###
###SITEURL###');
    /**
     * Filters the text of the email sent when an account action is attempted.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###DESCRIPTION### Description of the action being performed so the user knows what the email is for.
     * ###CONFIRM_URL### The link to click on to confirm the account action.
     * ###SITENAME###    The name of the site.
     * ###SITEURL###     The URL to the site.
     *
     * @since 4.9.6
     *
     * @param string $email_text Text in the email.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $content = apply_filters('user_request_action_email_content', $email_text, $email_data);
    $content = str_replace('###DESCRIPTION###', $email_data['description'], $content);
    $content = str_replace('###CONFIRM_URL###', esc_url_raw($email_data['confirm_url']), $content);
    $content = str_replace('###EMAIL###', $email_data['email'], $content);
    $content = str_replace('###SITENAME###', wp_specialchars_decode($email_data['sitename'], ENT_QUOTES), $content);
    $content = str_replace('###SITEURL###', esc_url_raw($email_data['siteurl']), $content);
    $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    /* translators: Privacy data request subject. 1: Site name, 2: Name of the action */
    $subject = sprintf(__('[%1$s] Confirm Action: %2$s'), $blogname, $email_data['description']);
    /**
     * Filters the subject of the email sent when an account action is attempted.
     *
     * @since 4.9.6
     *
     * @param string $subject    The email subject.
     * @param string $blogname   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $subject = apply_filters('user_request_action_email_subject', $subject, $blogname, $email_data);
    return wp_mail($email_data['email'], $subject, $content);
}

WordPress Version: 9.6

/**
 * Send a confirmation request email to confirm an action.
 *
 * If the request is not already pending, it will be updated.
 *
 * @since 4.9.6
 *
 * @param string $request_id ID of the request created via wp_create_user_request().
 * @return WP_Error|bool Will return true/false based on the success of sending the email, or a WP_Error object.
 */
function wp_send_user_request($request_id)
{
    $request_id = absint($request_id);
    $request = wp_get_user_request_data($request_id);
    if (!$request) {
        return new WP_Error('user_request_error', __('Invalid request.'));
    }
    $email_data = array('email' => $request->email, 'description' => wp_user_request_action_description($request->action_name), 'confirm_url' => add_query_arg(array('action' => 'confirmaction', 'request_id' => $request_id, 'confirm_key' => wp_generate_user_request_key($request_id)), site_url('wp-login.php')), 'sitename' => is_multisite() ? get_site_option('site_name') : get_option('blogname'), 'siteurl' => network_home_url());
    /* translators: Do not translate DESCRIPTION, CONFIRM_URL, EMAIL, SITENAME, SITEURL: those are placeholders. */
    $email_text = __('Howdy,

A request has been made to perform the following action on your account:

     ###DESCRIPTION###

To confirm this, please click on the following link:
###CONFIRM_URL###

You can safely ignore and delete this email if you do not want to
take this action.

This email has been sent to ###EMAIL###.

Regards,
All at ###SITENAME###
###SITEURL###');
    /**
     * Filters the text of the email sent when an account action is attempted.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###DESCRIPTION### Description of the action being performed so the user knows what the email is for.
     * ###CONFIRM_URL### The link to click on to confirm the account action.
     * ###EMAIL###       The email we are sending to.
     * ###SITENAME###    The name of the site.
     * ###SITEURL###     The URL to the site.
     *
     * @since 4.9.6
     *
     * @param string $email_text Text in the email.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $content = apply_filters('user_request_action_email_content', $email_text, $email_data);
    $content = str_replace('###DESCRIPTION###', $email_data['description'], $content);
    $content = str_replace('###CONFIRM_URL###', esc_url_raw($email_data['confirm_url']), $content);
    $content = str_replace('###EMAIL###', $email_data['email'], $content);
    $content = str_replace('###SITENAME###', wp_specialchars_decode($email_data['sitename'], ENT_QUOTES), $content);
    $content = str_replace('###SITEURL###', esc_url_raw($email_data['siteurl']), $content);
    $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    /* translators: Privacy data request subject. 1: Site name, 2: Name of the action */
    $subject = sprintf(__('[%1$s] Confirm Action: %2$s'), $blogname, $email_data['description']);
    /**
     * Filters the subject of the email sent when an account action is attempted.
     *
     * @since 4.9.6
     *
     * @param string $subject    The email subject.
     * @param string $blogname   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $subject = apply_filters('user_request_action_email_subject', $subject, $blogname, $email_data);
    return wp_mail($email_data['email'], $subject, $content);
}

WordPress Version: .10

/**
 * Send a confirmation request email to confirm an action.
 *
 * If the request is not already pending, it will be updated.
 *
 * @since 4.9.6
 *
 * @param string $request_id ID of the request created via wp_create_user_request().
 * @return WP_Error|bool Will return true/false based on the success of sending the email, or a WP_Error object.
 */
function wp_send_user_request($request_id)
{
    $request_id = absint($request_id);
    $request = wp_get_user_request_data($request_id);
    if (!$request) {
        return new WP_Error('user_request_error', __('Invalid request.'));
    }
    $email_data = array('request' => $request, 'email' => $request->email, 'description' => wp_user_request_action_description($request->action_name), 'confirm_url' => add_query_arg(array('action' => 'confirmaction', 'request_id' => $request_id, 'confirm_key' => wp_generate_user_request_key($request_id)), wp_login_url()), 'sitename' => wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), 'siteurl' => home_url());
    /* translators: Do not translate DESCRIPTION, CONFIRM_URL, SITENAME, SITEURL: those are placeholders. */
    $email_text = __('Howdy,

A request has been made to perform the following action on your account:

     ###DESCRIPTION###

To confirm this, please click on the following link:
###CONFIRM_URL###

You can safely ignore and delete this email if you do not want to
take this action.

Regards,
All at ###SITENAME###
###SITEURL###');
    /**
     * Filters the text of the email sent when an account action is attempted.
     *
     * The following strings have a special meaning and will get replaced dynamically:
     *
     * ###DESCRIPTION### Description of the action being performed so the user knows what the email is for.
     * ###CONFIRM_URL### The link to click on to confirm the account action.
     * ###SITENAME###    The name of the site.
     * ###SITEURL###     The URL to the site.
     *
     * @since 4.9.6
     *
     * @param string $email_text Text in the email.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $content = apply_filters('user_request_action_email_content', $email_text, $email_data);
    $content = str_replace('###DESCRIPTION###', $email_data['description'], $content);
    $content = str_replace('###CONFIRM_URL###', esc_url_raw($email_data['confirm_url']), $content);
    $content = str_replace('###EMAIL###', $email_data['email'], $content);
    $content = str_replace('###SITENAME###', $email_data['sitename'], $content);
    $content = str_replace('###SITEURL###', esc_url_raw($email_data['siteurl']), $content);
    /* translators: Privacy data request subject. 1: Site name, 2: Name of the action */
    $subject = sprintf(__('[%1$s] Confirm Action: %2$s'), $email_data['sitename'], $email_data['description']);
    /**
     * Filters the subject of the email sent when an account action is attempted.
     *
     * @since 4.9.6
     *
     * @param string $subject    The email subject.
     * @param string $sitename   The name of the site.
     * @param array  $email_data {
     *     Data relating to the account action email.
     *
     *     @type WP_User_Request $request     User request object.
     *     @type string          $email       The email address this is being sent to.
     *     @type string          $description Description of the action being performed so the user knows what the email is for.
     *     @type string          $confirm_url The link to click on to confirm the account action.
     *     @type string          $sitename    The site name sending the mail.
     *     @type string          $siteurl     The site URL sending the mail.
     * }
     */
    $subject = apply_filters('user_request_action_email_subject', $subject, $email_data['sitename'], $email_data);
    return wp_mail($email_data['email'], $subject, $content);
}