Filter hook 'new_site_email'

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

View Source

new_site_email

Filter Hook
Description
Filters the content of the email sent to the Multisite network administrator when a new site is created. Content should be formatted for transmission via wp_mail(). }

Hook Information

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

Hook Parameters

Type Name Description
array $new_site_email { Used to build wp_mail().
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 new_site_email
add_filter('new_site_email', 'my_custom_filter', 10, 3);

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

Source Code Context

wp-includes/ms-functions.php:1847 - How this hook is used in WordPress core
<?php
1842  	 *     @type string $headers Headers.
1843  	 * }
1844  	 * @param WP_Site $site         Site object of the new site.
1845  	 * @param WP_User $user         User object of the administrator of the new site.
1846  	 */
1847  	$new_site_email = apply_filters( 'new_site_email', $new_site_email, $site, $user );
1848  
1849  	wp_mail(
1850  		$new_site_email['to'],
1851  		wp_specialchars_decode( $new_site_email['subject'] ),
1852  		$new_site_email['message'],

PHP Documentation

<?php
/**
	 * Filters the content of the email sent to the Multisite network administrator when a new site is created.
	 *
	 * Content should be formatted for transmission via wp_mail().
	 *
	 * @since 5.6.0
	 *
	 * @param array $new_site_email {
	 *     Used to build wp_mail().
	 *
	 *     @type string $to      The email address of the recipient.
	 *     @type string $subject The subject of the email.
	 *     @type string $message The content of the email.
	 *     @type string $headers Headers.
	 * }
	 * @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.