Filter hook 'send_new_site_email'

in WP Core File wp-includes/ms-functions.php at line 1782

View Source

send_new_site_email

Filter Hook
Description
Filters whether to send an email to the Multisite network administrator when a new site is created. Return false to disable sending the email.

Hook Information

File Location wp-includes/ms-functions.php View on GitHub
Hook Type Filter
Line Number 1782

Hook Parameters

Type Name Description
bool $send Whether to send the email.
WP_Site $site Site object of the new site.
WP_User $user User object of the administrator of the new site.

Usage Examples

Basic Usage
<?php
// Hook into send_new_site_email
add_filter('send_new_site_email', 'my_custom_filter', 10, 3);

function my_custom_filter($send, $site, $user) {
    // Your custom filtering logic here
    return $send;
}

Source Code Context

wp-includes/ms-functions.php:1782 - How this hook is used in WordPress core
<?php
1777  	 *
1778  	 * @param bool    $send Whether to send the email.
1779  	 * @param WP_Site $site Site object of the new site.
1780  	 * @param WP_User $user User object of the administrator of the new site.
1781  	 */
1782  	if ( ! apply_filters( 'send_new_site_email', true, $site, $user ) ) {
1783  		return false;
1784  	}
1785  
1786  	$switched_locale = false;
1787  	$network_admin   = get_user_by( 'email', $email );

PHP Documentation

<?php
/**
	 * Filters whether to send an email to the Multisite network administrator when a new site is created.
	 *
	 * Return false to disable sending the email.
	 *
	 * @since 5.6.0
	 *
	 * @param bool    $send Whether to send the email.
	 * @param WP_Site $site Site object of the new site.
	 * @param WP_User $user User object of the administrator of the new site.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 3
  • File: wp-includes/ms-functions.php
Related Hooks

Related hooks will be displayed here in future updates.