ms_site_check()

Checks status of current blog.

Description

Checks if the blog is deleted, inactive, archived, or spammed.

Dies with a default message if the blog does not pass the check.

To change the default message when a blog does not pass the check, use the wp-content/blog-deleted.php, blog-inactive.php and blog-suspended.php drop-ins.

Return

(true|string) Returns true on success, or drop-in file to include.

Source

File: wp-includes/ms-load.php

function ms_site_check() {

	/**
	 * Filters checking the status of the current blog.
	 *
	 * @since 3.0.0
	 *
	 * @param bool|null $check Whether to skip the blog status check. Default null.
	 */
	$check = apply_filters( 'ms_site_check', null );
	if ( null !== $check ) {
		return true;
	}

	// Allow super admins to see blocked sites.
	if ( is_super_admin() ) {
		return true;
	}

	$blog = get_site();

	if ( '1' == $blog->deleted ) {
		if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) ) {
			return WP_CONTENT_DIR . '/blog-deleted.php';
		} else {
			wp_die( __( 'This site is no longer available.' ), '', array( 'response' => 410 ) );
		}
	}

	if ( '2' == $blog->deleted ) {
		if ( file_exists( WP_CONTENT_DIR . '/blog-inactive.php' ) ) {
			return WP_CONTENT_DIR . '/blog-inactive.php';
		} else {
			$admin_email = str_replace( '@', ' AT ', get_site_option( 'admin_email', 'support@' . get_network()->domain ) );
			wp_die(
				sprintf(
					/* translators: %s: Admin email link. */
					__( 'This site has not been activated yet. If you are having problems activating your site, please contact %s.' ),
					sprintf( '<a href="mailto:%1$s">%1$s</a>', $admin_email )
				)
			);
		}
	}

	if ( '1' == $blog->archived || '1' == $blog->spam ) {
		if ( file_exists( WP_CONTENT_DIR . '/blog-suspended.php' ) ) {
			return WP_CONTENT_DIR . '/blog-suspended.php';
		} else {
			wp_die( __( 'This site has been archived or suspended.' ), '', array( 'response' => 410 ) );
		}
	}

	return true;
}

Changelog

Version Description
3.0.0 Introduced.

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/ms_site_check