Customizing Deleted/Archived blogs warning pages

The function that deals with this is ms_site_check().

If existent, it will use the following files. And they should render a full custom HTML page.

  • WP_CONTENT_DIR . '/blog-deleted.php'
  • WP_CONTENT_DIR . '/blog-inactive.php'
  • WP_CONTENT_DIR . '/blog-suspended.php'

Another option is to short-circuit the process and redirect the visitor. It has to be done with a Must Use plugin and here using a PHP 5.3 anonymous function as callback.

<?php
/**
 * Plugin Name: Prevent Archived/Deleted blogs warning in Multisite
 * Plugin Url: https://wordpress.stackexchange.com/q/98151/1261
 * Version: 1.0
 * Author: Rodolfo Buaiz
 * Author URI: https://wordpress.stackexchange.com/users/12615/brasofilo
 */

add_filter( 
    'ms_site_check',
    function() 
    {
        // Super admins should be able to see it
        if( current_user_can( 'manage_network' ) )
            return;

        $blog = get_blog_details();
        if(
            '1' == $blog->deleted 
            or '2' == $blog->deleted
            or '1' == $blog->archived 
            or '1' == $blog->spam
        )
        {
            wp_redirect( network_site_url() );
            die();
        }
    } 
);

Related Q&A: How to disable Multisite sign-up page?

Leave a Comment