Make WordPress Core

Changeset 33990


Ignore:
Timestamp:
09/10/2015 05:05:14 AM (9 years ago)
Author:
jeremyfelt
Message:

Multisite: Add action to handle network not found

ms_network_not_found fires when the global $current_site has not been filled and ms_not_installed() is about to fire. It cannot be used to populate $current_site, but can be used to capture the request and redirect or present a custom error.

Props rmccue.
Fixes #31702.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-settings.php

    r33989 r33990  
    8787
    8888        if ( empty( $current_site ) ) {
     89            /**
     90             * Fires when a network cannot be found based on the requested domain and path.
     91             *
     92             * At the time of this action, the only recourse is to redirect somewhere
     93             * and exit. If you want to declare a particular network, do so earlier.
     94             *
     95             * @since 4.4.0
     96             *
     97             * @param string $domain       The domain used to search for a network.
     98             * @param string $path         The path used to search for a path.
     99             */
     100            do_action( 'ms_network_not_found', $domain, $path );
     101
    89102            ms_not_installed( $domain, $path );
    90103        } elseif ( $path === $current_site->path ) {
     
    112125    // No network has been found, bail.
    113126    if ( empty( $current_site ) ) {
     127        /** This action is documented in wp-includes/ms-settings.php */
     128        do_action( 'ms_network_not_found', $domain, $path );
     129
    114130        ms_not_installed( $domain, $path );
    115131    }
Note: See TracChangeset for help on using the changeset viewer.