wpmu_welcome_notification( int $blog_id, int $user_id, string $password, string $title, array $meta = array() ): bool
- Since
- MU (3.0.0)
- Source
wp-includes/ms-functions.php:1637
Description
Filter 'wpmu_welcome_notification' to disable or bypass.
Filter 'update_welcome_email' and 'update_welcome_subject' to modify the content and subject line of the notification email.
Compatibility
- WordPress
- since MU (3.0.0)
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Parameters
$blog_idint- Site ID.
$user_idint- User ID.
$passwordstring- User password, or "N/A" if the user account is not new.
$titlestring- Site title.
$metaarrayoptional- Signup meta data. By default, contains the requested privacy setting and lang_id.Default:
array()
Return value
bool- Whether the email notification was sent.
Performance profile
How much work a call to wpmu_welcome_notification() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Expensive
- Scaling
- Constant
- Instructions
- 18–142
- Plugin surface
- 3 hooks
- Called by
- 0
Sends mail via wp_mail().
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 144.
Third-party callbacks on 'wpmu_welcome_notification', 'update_welcome_email', 'update_welcome_subject' run inside this call, and their cost is not bounded by anything here.
Nothing in core calls this; the cost is only what you spend yourself.
What it touches
- hookthird-party callbacks
apply_filters()called directly - optionnetwork option
get_site_option()called directly - mailsends mail
wp_mail()called directly - querycontent query
get_user_by()one call below wpmu_welcome_notification() - cacheobject cache
wp_cache_get()one call below wpmu_welcome_notification() - serializeserialisation
maybe_unserialize()one call below wpmu_welcome_notification()
Further down the call graph this can also reach transient. That is the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 17 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost wpmu_welcome_notification() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!apply_filters() | 18 | get_network(), apply_filters() |
apply_filters() && $admin_email !== "" | 119–121 | get_network(), apply_filters(), get_userdata(), switch_to_user_locale(), get_site_option(), get_blogaddress_by_id(), apply_filters(), get_site_option(), get_site_option(), get_option(), __(), wp_unslash(), sprintf(), apply_filters(), wp_specialchars_decode(), wp_mail() |
apply_filters() && $admin_email !== "" | 121–123 | get_network(), apply_filters(), get_userdata(), switch_to_user_locale(), get_site_option(), get_blogaddress_by_id(), apply_filters(), get_site_option(), get_site_option(), get_option(), __(), wp_unslash(), sprintf(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
apply_filters() && $admin_email !== "" | 123–125 | get_network(), apply_filters(), get_userdata(), switch_to_user_locale(), get_site_option(), __(), get_blogaddress_by_id(), apply_filters(), get_site_option(), get_site_option(), get_option(), __(), wp_unslash(), sprintf(), apply_filters(), wp_specialchars_decode(), wp_mail() |
apply_filters() && $admin_email !== "" | 125–127 | get_network(), apply_filters(), get_userdata(), switch_to_user_locale(), get_site_option(), __(), get_blogaddress_by_id(), apply_filters(), get_site_option(), get_site_option(), get_option(), __(), wp_unslash(), sprintf(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
apply_filters() && $admin_email !== "" | 126–128 | get_network(), apply_filters(), get_userdata(), switch_to_user_locale(), get_site_option(), get_blogaddress_by_id(), apply_filters(), get_site_option(), get_site_option(), get_site_option(), esc_html(), get_option(), __(), wp_unslash(), sprintf(), apply_filters(), wp_specialchars_decode(), wp_mail() |
apply_filters() && $admin_email === "" | 127–129 | get_network(), apply_filters(), get_userdata(), switch_to_user_locale(), get_site_option(), get_blogaddress_by_id(), apply_filters(), get_site_option(), network_home_url(), wp_parse_url(), get_site_option(), get_option(), __(), wp_unslash(), sprintf(), apply_filters(), wp_specialchars_decode(), wp_mail() |
apply_filters() && $admin_email !== "" | 128–130 | get_network(), apply_filters(), get_userdata(), switch_to_user_locale(), get_site_option(), get_blogaddress_by_id(), apply_filters(), get_site_option(), get_site_option(), get_site_option(), esc_html(), get_option(), __(), wp_unslash(), sprintf(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
apply_filters() && $admin_email === "" | 129–131 | get_network(), apply_filters(), get_userdata(), switch_to_user_locale(), get_site_option(), get_blogaddress_by_id(), apply_filters(), get_site_option(), network_home_url(), wp_parse_url(), get_site_option(), get_option(), __(), wp_unslash(), sprintf(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
apply_filters() && $admin_email !== "" | 130–132 | get_network(), apply_filters(), get_userdata(), switch_to_user_locale(), get_site_option(), __(), get_blogaddress_by_id(), apply_filters(), get_site_option(), get_site_option(), get_site_option(), esc_html(), get_option(), __(), wp_unslash(), sprintf(), apply_filters(), wp_specialchars_decode(), wp_mail() |
apply_filters() && $admin_email === "" | 131–133 | get_network(), apply_filters(), get_userdata(), switch_to_user_locale(), get_site_option(), __(), get_blogaddress_by_id(), apply_filters(), get_site_option(), network_home_url(), wp_parse_url(), get_site_option(), get_option(), __(), wp_unslash(), sprintf(), apply_filters(), wp_specialchars_decode(), wp_mail() |
apply_filters() && $admin_email !== "" | 132–134 | get_network(), apply_filters(), get_userdata(), switch_to_user_locale(), get_site_option(), __(), get_blogaddress_by_id(), apply_filters(), get_site_option(), get_site_option(), get_site_option(), esc_html(), get_option(), __(), wp_unslash(), sprintf(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
5 further outcomes, up to 142 instructions
apply_filters() && $admin_email === "" | 133–135 | get_network(), apply_filters(), get_userdata(), switch_to_user_locale(), get_site_option(), __(), get_blogaddress_by_id(), apply_filters(), get_site_option(), network_home_url(), wp_parse_url(), get_site_option(), get_option(), __(), wp_unslash(), sprintf(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
apply_filters() && $admin_email === "" | 134–136 | get_network(), apply_filters(), get_userdata(), switch_to_user_locale(), get_site_option(), get_blogaddress_by_id(), apply_filters(), get_site_option(), network_home_url(), wp_parse_url(), get_site_option(), get_site_option(), esc_html(), get_option(), __(), wp_unslash(), sprintf(), apply_filters(), wp_specialchars_decode(), wp_mail() |
apply_filters() && $admin_email === "" | 136–138 | get_network(), apply_filters(), get_userdata(), switch_to_user_locale(), get_site_option(), get_blogaddress_by_id(), apply_filters(), get_site_option(), network_home_url(), wp_parse_url(), get_site_option(), get_site_option(), esc_html(), get_option(), __(), wp_unslash(), sprintf(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
apply_filters() && $admin_email === "" | 138–140 | get_network(), apply_filters(), get_userdata(), switch_to_user_locale(), get_site_option(), __(), get_blogaddress_by_id(), apply_filters(), get_site_option(), network_home_url(), wp_parse_url(), get_site_option(), get_site_option(), esc_html(), get_option(), __(), wp_unslash(), sprintf(), apply_filters(), wp_specialchars_decode(), wp_mail() |
apply_filters() && $admin_email === "" | 140–142 | get_network(), apply_filters(), get_userdata(), switch_to_user_locale(), get_site_option(), __(), get_blogaddress_by_id(), apply_filters(), get_site_option(), network_home_url(), wp_parse_url(), get_site_option(), get_site_option(), esc_html(), get_option(), __(), wp_unslash(), sprintf(), apply_filters(), wp_specialchars_decode(), wp_mail(), restore_previous_locale() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 143 | 18–141 | 6 | 1 fewer instruction than PHP 8.5 |
| 8.5 | 144 | 18–142 | 6 | |
| 8.4 | 144 | 18–142 | 6 | 15 fewer instructions than PHP 8.3 |
| 8.3 | 159 | 18–157 | 6 | |
| 8.2 | 159 | 18–157 | 6 | |
| 8.1 | 159 | 18–157 | 6 | |
| 7.4 | 159 | 18–157 | 6 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Hooks and filters fired · 3
3 hooks fire while wpmu_welcome_notification() runs, in this order:
- apply_filters( wpmu_welcome_notification )filterline 1660 (+23 into the body)
Filters whether to bypass the welcome email sent to the site administrator after site activation.
- apply_filters( update_welcome_email )filterline 1712 (+75 into the body)
Filters the content of the welcome email sent to the site administrator after site activation.
- apply_filters( update_welcome_subject )filterline 1738 (+101 into the body)
Filters the subject of the welcome email sent to the site administrator after site activation.
Uses · 15
- get_network()Retrieves network data given a network ID or network object.
- apply_filters()Calls the callback functions that have been added to a filter hook.
- get_userdata()Retrieves user info by user ID.
- switch_to_user_locale()Switches the translations according to the given user's locale.
- get_site_option()Retrieve an option value for the current network based on name of option.
- __()Retrieves the translation of $text.
- get_blogaddress_by_id()Gets a full site URL, given a site ID.
- wp_parse_url()A wrapper for PHP's parse_url() function that handles consistency in the return values across PHP versions.
- network_home_url()Retrieves the home URL for the current network.
- esc_html()Escaping for HTML blocks.
- get_option()Retrieves an option value based on an option name.
- wp_unslash()Removes slashes from a string or recursively removes slashes from strings within an array.
Show all 15
- wp_mail()Sends an email, similar to PHP's mail function.
- wp_specialchars_decode()Converts a number of HTML entities into their special characters.
- restore_previous_locale()Restores the translations according to the previous locale.
Source code
function wpmu_welcome_notification( $blog_id, $user_id, #[\SensitiveParameter] $password, $title, $meta = array()) { $current_network = get_network(); /** * Filters whether to bypass the welcome email sent to the site administrator after site activation. * * Returning false disables the welcome email. * * @since MU (3.0.0) * * @param int|false $blog_id Site ID, or false to prevent the email from sending. * @param int $user_id User ID of the site administrator. * @param string $password User password, or "N/A" if the user account is not new. * @param string $title Site title. * @param array $meta Signup meta data. By default, contains the requested privacy setting and lang_id. */ if ( ! apply_filters( 'wpmu_welcome_notification', $blog_id, $user_id, $password, $title, $meta ) ) { return false; } $user = get_userdata( $user_id ); $switched_locale = switch_to_user_locale( $user_id ); $welcome_email = get_site_option( 'welcome_email' ); if ( ! $welcome_email ) { /* translators: Do not translate USERNAME, SITE_NAME, BLOG_URL, PASSWORD: those are placeholders. */ $welcome_email = __( 'Howdy USERNAME, Your new SITE_NAME site has been successfully set up at:BLOG_URL You can log in to the administrator account with the following information: Username: USERNAMEPassword: PASSWORDLog in here: BLOG_URLwp-login.php We hope you enjoy your new site. Thanks! --The Team @ SITE_NAME' ); } $url = get_blogaddress_by_id( $blog_id ); $welcome_email = str_replace( 'SITE_NAME', $current_network->site_name, $welcome_email ); $welcome_email = str_replace( 'BLOG_TITLE', $title, $welcome_email ); $welcome_email = str_replace( 'BLOG_URL', $url, $welcome_email ); $welcome_email = str_replace( 'USERNAME', $user->user_login, $welcome_email ); $welcome_email = str_replace( 'PASSWORD', $password, $welcome_email ); /** * Filters the content of the welcome email sent to the site administrator after site activation. * * Content should be formatted for transmission via wp_mail(). * * @since MU (3.0.0) * * @param string $welcome_email Message body of the email. * @param int $blog_id Site ID. * @param int $user_id User ID of the site administrator. * @param string $password User password, or "N/A" if the user account is not new. * @param string $title Site title. * @param array $meta Signup meta data. By default, contains the requested privacy setting and lang_id. */ $welcome_email = apply_filters( 'update_welcome_email', $welcome_email, $blog_id, $user_id, $password, $title, $meta ); $admin_email = get_site_option( 'admin_email' ); if ( '' === $admin_email ) {Changelog
Introduced in MU (3.0.0). Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, from
src/wp-includes/ms-functions.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.