How to disable Multisite sign-up page?

If we try to access a non-existant Multisite site, e.g., http://site1.example.com or http://example.com/site1/, we are redirected to http://example.com/wp-signup.php?new=site1.

How to block this and redirect the browser to another page?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

[Update]

An alternative (maybe better) is to use the following constant in wp-config.php:

define( 'NOBLOGREDIRECT', 'http://example.com' );

At the very beginning of wp-signup.php file there is this code:

function do_signup_header() {
    do_action( 'signup_header' );
}
add_action( 'wp_head', 'do_signup_header' );

So, it’s just a matter of adding the signup_header action hook to break any further execution and redirect the browser to other URL.

Here, wrapped as a Must Use Plugin:

<?php
/*
    Plugin Name: Multisite - Prevent Sign-up Page
    Plugin Url: http://wordpress.stackexchange.com/q/85529/12615
    Version: 1.0
    Author: Rodolfo Buaiz
*/

add_action( 'signup_header', 'rbz_prevent_multisite_signup' );

function rbz_prevent_multisite_signup() 
{
    wp_redirect( site_url() );
    die();
}

Method 2

I found a solution in this article

I had the wrong SUBDOMAIN_INSTALL setting value in my config file.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x