do_action( ‘ms_site_not_found’, WP_Network $current_site, string $domain, string $path )

Fires when a network can be determined but a site cannot.

Description

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.

Parameters

$current_siteWP_Network
The network that had been determined.
$domainstring
The domain used to search for a site.
$pathstring
The path used to search for a site.

Source

do_action( 'ms_site_not_found', $current_site, $domain, $path );

Changelog

VersionDescription
3.9.0Introduced.

User Contributed Notes

  1. Skip to note 2 content

    To use this hook you must use the SUNRISE file.
    https://docs.wpvip.com/wordpress-on-vip/multisites/sunrise-php/

    // located in ms-settings.php
    if ( defined( 'SUNRISE' ) ) {
    	include_once WP_CONTENT_DIR . '/sunrise.php';
    }

    Add define( 'SUNRISE', true ); to the wp-config.php.

    Then create a file in the /wp-content/ directory called sunrise.php.

    You can then access the ms_site_not_found action.

    // inside sunrise.php
    function wpdocs_ms_site_not_found( $current_site, $domain, $path ) {
    	global $wpdb;
    
    	// DO STUFF....
    
    }
    add_action( 'ms_site_not_found', 'wpdocs_ms_site_not_found', 10, 3 );

You must log in before being able to contribute a note or feedback.