0

When we try to access a Deleted or Archived site in Multisite, WordPress shows a wp_die() message.

This site has been archived or suspended.

And this message appears for Deleted sites:

This user has elected to delete their account and the content is no longer available.

How can we customize that?

3

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?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.