ms_site_check

Checks status of current blog.

Description

(true|string) ms_site_check(); 

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.

Returns (true|string)

Returns true on success, or drop-in file to include.


Usage

  1. if ( !function_exists( 'ms_site_check' ) ) { 
  2. require_once ABSPATH . WPINC . '/ms-load.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = ms_site_check(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/ms-load.php  
  1. function ms_site_check() { 
  2.  
  3. /** 
  4. * Filters checking the status of the current blog. 
  5. * @since 3.0.0 
  6. * @param bool null Whether to skip the blog status check. Default null. 
  7. */ 
  8. $check = apply_filters( 'ms_site_check', null ); 
  9. if ( null !== $check ) 
  10. return true; 
  11.  
  12. // Allow super admins to see blocked sites 
  13. if ( is_super_admin() ) 
  14. return true; 
  15.  
  16. $blog = get_site(); 
  17.  
  18. if ( '1' == $blog->deleted ) { 
  19. if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) ) 
  20. return WP_CONTENT_DIR . '/blog-deleted.php'; 
  21. else 
  22. wp_die( __( 'This site is no longer available.' ), '', array( 'response' => 410 ) ); 
  23.  
  24. if ( '2' == $blog->deleted ) { 
  25. if ( file_exists( WP_CONTENT_DIR . '/blog-inactive.php' ) ) { 
  26. return WP_CONTENT_DIR . '/blog-inactive.php'; 
  27. } else { 
  28. $admin_email = str_replace( '@', ' AT ', get_site_option( 'admin_email', 'support@' . get_network()->domain ) ); 
  29. wp_die
  30. /** translators: %s: admin email link */ 
  31. sprintf( __( 'This site has not been activated yet. If you are having problems activating your site, please contact %s.' ),  
  32. sprintf( '<a href="mailto:%s">%s</a>', $admin_email ) 
  33. ); 
  34.  
  35. if ( $blog->archived == '1' || $blog->spam == '1' ) { 
  36. if ( file_exists( WP_CONTENT_DIR . '/blog-suspended.php' ) ) 
  37. return WP_CONTENT_DIR . '/blog-suspended.php'; 
  38. else 
  39. wp_die( __( 'This site has been archived or suspended.' ), '', array( 'response' => 410 ) ); 
  40.  
  41. return true;