Action hook 'ms_site_not_found'

in WP Core File wp-includes/ms-load.php at line 418

View Source

ms_site_not_found

Action Hook
Description
Fires when a network can be determined but a site cannot. At the time of this action, the only recourse is to redirect somewhere and exit. If you want to declare a particular site, do so earlier.

Hook Information

File Location wp-includes/ms-load.php View on GitHub
Hook Type Action
Line Number 418

Hook Parameters

Type Name Description
WP_Network $current_site The network that had been determined.
string $domain The domain used to search for a site.
string $path The path used to search for a site.

Usage Examples

Basic Usage
<?php
// Hook into ms_site_not_found
add_action('ms_site_not_found', 'my_custom_function', 10, 3);

function my_custom_function($current_site, $domain, $path) {
    // Your custom code here
}

Source Code Context

wp-includes/ms-load.php:418 - How this hook is used in WordPress core
<?php
 413  		 *
 414  		 * @param WP_Network $current_site The network that had been determined.
 415  		 * @param string     $domain       The domain used to search for a site.
 416  		 * @param string     $path         The path used to search for a site.
 417  		 */
 418  		do_action( 'ms_site_not_found', $current_site, $domain, $path );
 419  
 420  		if ( $subdomain && ! defined( 'NOBLOGREDIRECT' ) ) {
 421  			// For a "subdomain" installation, redirect to the signup form specifically.
 422  			$destination .= 'wp-signup.php?new=' . str_replace( '.' . $current_site->domain, '', $domain );
 423  		} elseif ( $subdomain ) {

PHP Documentation

<?php
/**
		 * Fires when a network can be determined but a site cannot.
		 *
		 * At the time of this action, the only recourse is to redirect somewhere
		 * and exit. If you want to declare a particular site, do so earlier.
		 *
		 * @since 3.9.0
		 *
		 * @param WP_Network $current_site The network that had been determined.
		 * @param string     $domain       The domain used to search for a site.
		 * @param string     $path         The path used to search for a site.
		 */
Quick Info
  • Hook Type: Action
  • Parameters: 3
  • File: wp-includes/ms-load.php
Related Hooks

Related hooks will be displayed here in future updates.