# Redirect wp-signup.php When Registration Is Closed

> Sends visitors who land on wp-signup.php to a page you choose (or the homepage) when network registration is turned off, instead of showing a bare "Registration has been disabled" screen.

- Type: PHP
- Runs: Run everywhere
- Category: [Multisite](https://wpide.com/library/category/multisite/)
- Tags: signup, redirect, registration
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/ms-signup-closed-redirect/

## Code

```php
if ( ! is_multisite() ) {
    return;
}

$wpide_target = '/'; // Path on the main site or full URL.

add_action( 'before_signup_header', function () use ( $wpide_target ) {
    if ( 'none' !== get_site_option( 'registration', 'none' ) || is_super_admin() ) {
        return;
    }

    $url = wp_http_validate_url( $wpide_target ) ? $wpide_target : network_home_url( $wpide_target );
    wp_safe_redirect( $url, 302 );
    exit;
} );

add_filter( 'allowed_redirect_hosts', function ( $hosts ) use ( $wpide_target ) {
    $host = wp_parse_url( $wpide_target, PHP_URL_HOST );
    if ( $host ) {
        $hosts[] = $host;
    }
    return $hosts;
} );
```

## Notes

Set $wpide_target to a full URL or a path on the main site.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Redirect wp-signup.php When Registration Is Closed" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
