WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Redirect when site is either archived or deactivated (4 posts)

  1. AudicerStudio
    Member
    Posted 1 year ago #

    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?

  2. David Sader
    Member
    Posted 1 year ago #

    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

  3. AudicerStudio
    Member
    Posted 1 year ago #

    Thanks. I'll give this a try.

  4. AudicerStudio
    Member
    Posted 1 year ago #

    This works thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic