Using WordPress ‘ms_site_check()’ PHP function

The ms_site_check() WordPress PHP function checks the status of the current blog.

Usage

ms_site_check();

Parameters

  • None

More information

See WordPress Developer Resources: ms_site_check()
This function was introduced in WordPress version 3.0.0.

Examples

Check blog status and exit if it doesn’t pass the check

The following code snippet checks the blog status and exits if it fails the check.

// Check the blog status
ms_site_check();

Create a custom blog-deleted.php file

If the blog is deleted, you can create a custom blog-deleted.php file in the wp-content folder with a custom message.

// In your wp-content/blog-deleted.php file
echo "This blog has been deleted. Please contact the administrator for more information.";
exit;

Create a custom blog-inactive.php file

If the blog is inactive, you can create a custom blog-inactive.php file in the wp-content folder with a custom message.

// In your wp-content/blog-inactive.php file
echo "This blog is currently inactive. Please check back later.";
exit;

Create a custom blog-suspended.php file

If the blog is spammed or archived, you can create a custom blog-suspended.php file in the wp-content folder with a custom message.

// In your wp-content/blog-suspended.php file
echo "This blog has been suspended. Please contact the administrator for more information.";
exit;

Combine ms_site_check() with other functions

You can combine ms_site_check() with other functions to perform additional actions if the blog passes the check.

// Check the blog status
ms_site_check();

// Additional actions if the blog passes the check
echo "The blog passed the check!";