
如何实现WordPress网站降级(用于解决插件和主题问题)
ms_site_check ( No parameters )
ms_site_check: 这个函数检查当前站点是否是网络中的一个有效站点。如果网站是有效的,它返回一个布尔值为true,否则为false。
检查当前博客的状态。
检查博客是否被删除、不活跃、被归档或被垃圾邮件攻击。
如果博客没有通过检查,则以默认信息结束。
要改变博客未通过检查时的默认信息,请使用wp-content/blog-deleted.php、blog-inactive.php和blog-suspended.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; }