WordPress.org

Support

Support » Multisite » [Resolved] Redirect when site is either archived or deactivated

[Resolved] Redirect when site is either archived or deactivated

  • Is there a way when i archive or deactivate a site that when someone tries to reach it without logging it, it would redirect them to the main site?

Viewing 3 replies - 1 through 3 (of 3 total)
  • 1)
    Add your own filter to ms_site_check in your own mu-plugin

    <?php
    function ds_redirect_inactives() {
    	if ( is_super_admin() )
    		return true;
    	$blog = get_blog_details();
    	//deleted or deactivated or archived
    		if ( '1' == $blog->deleted || $blog->archived == '1' ) {
    		wp_redirect( network_home_url() );
    		exit;
    	}
    }
    add_filter('ms_site_check','ds_redirect_inactives');
    ?>

    or 2)
    “drop in” your own custom pages into /wp-content/
    /blog-deleted.php
    /blog-inactive.php
    /blog-suspended.php

    Thanks. I’ll give this a try.

    This works thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Redirect when site is either archived or deactivated’ is closed to new replies.