A WordPress-centric search engine for devs and theme authors



ms_site_check ›

Since3.0.0
Deprecatedn/a
ms_site_check ( No parameters )
Returns:
  • (true|string) Returns true on success, or drop-in file to include.
Defined at:
Codex:

Checks status of current blog.

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.



Source

function ms_site_check() {

	/**
	 * Filters checking the status of the current blog.
	 *
	 * @since 3.0.0
	 *
	 * @param bool null 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(
				/* translators: %s: admin email link */
				sprintf( __( 'This site has not been activated yet. If you are having problems activating your site, please contact %s.' ),
					sprintf( '<a href="mailto:%s">%s</a>', $admin_email )
				)
			);
		}
	}

	if ( $blog->archived == '1' || $blog->spam == '1' ) {
		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;
}