Title: ms_site_not_found
Published: April 25, 2014
Last modified: May 20, 2026

---

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

## In this article

 * [Description](https://developer.wordpress.org/reference/hooks/ms_site_not_found/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/hooks/ms_site_not_found/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/ms_site_not_found/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/ms_site_not_found/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/ms_site_not_found/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/hooks/ms_site_not_found/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/hooks/ms_site_not_found/?output_format=md#wp--skip-link--target)

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

## 󠀁[Description](https://developer.wordpress.org/reference/hooks/ms_site_not_found/?output_format=md#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](https://developer.wordpress.org/reference/hooks/ms_site_not_found/?output_format=md#parameters)󠁿

 `$current_site`[WP_Network](https://developer.wordpress.org/reference/classes/wp_network/)

The network that had been determined.

`$domain`string

The domain used to search for a site.

`$path`string

The path used to search for a site.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/ms_site_not_found/?output_format=md#source)󠁿

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

[View all references](https://developer.wordpress.org/reference/files/wp-includes/ms-load.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/ms-load.php#L418)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/ms-load.php#L418-L418)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/ms_site_not_found/?output_format=md#related)󠁿

| Used by | Description | 
| [ms_load_current_site_and_network()](https://developer.wordpress.org/reference/functions/ms_load_current_site_and_network/)`wp-includes/ms-load.php` |

Identifies the network and site of a requested domain and path and populates the corresponding network and site global objects as part of the multisite bootstrap process.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/ms_site_not_found/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.9.0](https://developer.wordpress.org/reference/since/3.9.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/hooks/ms_site_not_found/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 2 content](https://developer.wordpress.org/reference/hooks/ms_site_not_found/?output_format=md#comment-content-7332)
 2.    [kingafrojoe](https://profiles.wordpress.org/kingafrojoe/)  [  1 year ago  ](https://developer.wordpress.org/reference/hooks/ms_site_not_found/#comment-7332)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fms_site_not_found%2F%23comment-7332)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fms_site_not_found%2F%23comment-7332)
 4.  To use this hook you must use the SUNRISE file.
      [https://docs.wpvip.com/wordpress-on-vip/multisites/sunrise-php/](https://docs.wpvip.com/wordpress-on-vip/multisites/sunrise-php/)
 5.      ```php
         // located in ms-settings.php
         if ( defined( 'SUNRISE' ) ) {
         	include_once WP_CONTENT_DIR . '/sunrise.php';
         }
         ```
     
 6.  Add `define( 'SUNRISE', true );` to the `wp-config.php`.
 7.  Then create a file in the `/wp-content/` directory called `sunrise.php`.
 8.  You can then access the `ms_site_not_found` action.
 9.      ```php
         // 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 );
         ```
     
 10.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fms_site_not_found%2F%3Freplytocom%3D7332%23feedback-editor-7332)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fms_site_not_found%2F)
before being able to contribute a note or feedback.