Blog / Tutorials / Enable WordPress User Registration on a Subsite Only

Enable WordPress User Registration on a Subsite Only

enable wordpress user registration on a subsite only
Cristian Antohe
Last Updated: 19/04/16

When you have WordPress Multisite active, all users are shared between all blogs because the wp_users table is the same for all blogs.

By default, it’s simply not possible to enable WordPress user registration on a subsite only. To go around this, first thing we need to do is enable registration in our network admin:

enable wordpress user registration on a subsite only

Next we need a small plugin. Simply create a new php file called multisite-block-registrations.php and add the code bellow to it:

We’ll use two filters:

  • wp_signup_location – this filters modifies the default WordPress redirect from /wp-login.php?action=register to /wp_signup.php
  • before_signup_header – we’ll use this action to redirect all users from /wp_signup.php to the homepage of the site they accessed it from.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
/**
 * @package Multisite_Block_Default_Registration
 * @version 1.0
 */
/*
Plugin Name: Multisite Block Default Registration
Plugin URI: http://www.cozmoslabs.com
Description: Block default registration page in multisite. Other registration pages may be used. This should be activated network wide.
Author: Cristian Antohe
Version: 1.0
Author URI: http://www.cozmoslabs.com
*/
 
add_filter( 'wp_signup_location', 'mbdr_current_blog_home' );
function mbdr_current_blog_home($location)
{
    return get_site_url();
}
 
add_action('before_signup_header', 'mbdr_redirect_signup_home');
function mbdr_redirect_signup_home(){
    wp_redirect( get_site_url() );
    exit();
}

Go a head an activate this plugin network wide.

Add a Registration form on a particular subsite

Now that you can’t register on any site in the network since we’re redirecting them to the homepage of the current site, we need to enable registration on a particular subsite only.

We’ll do that using the free Profile Builder plugin and the [wppb-register] shortcode.

enable wordpress user registration on a subsite only

That is all. You can take this further as to adding a login page using [wppb-login] shortcode or widget.

As for limitations, this won’t work if you enable user registration + blog creation. Profile Builder currently doesn’t support blog creation.

From the blog

Related Articles

what-is-wordpress-ver-2

Beginner’s Guide to: What Is WordPress?

Author: Cristian Antohe
Last Updated: February 15th, 2017

Ever now and again the question arises with new clients that aren't really tech savvy: "What Is WordPress?" What I'm hoping to achieve with this post is to drop the technical jargon for a minute and explain in down to earth words what is WordPress, how can it help you, what is WordPress.com, what's a […]

Continue Reading

How to Eliminate WordPress Spam Registrations (Step-by-Step Guide)

Author: Adrian Spiac
Last Updated: December 11th, 2019

Looking for a way to cut down on WordPress spam registrations? If your WordPress site is set to allow user registration (like a membership site or WooCommerce store), then it's probably vulnerable to user registration spam from spam-bots. Finding a way to eliminate, or at least reduce, WordPress spam registrations is important so that you can focus your efforts and resources on your real users. No matter what type of site you're running, there are some tried-and-true tactics that you can apply to stop spam registrations in their tracks, and they're all available in one single plugin.

Continue Reading

WordPress User Registration

Author: Cristian Antohe
Last Updated: February 24th, 2020

Have you hit a road block when it comes to WordPress user registration? You probably would like to have new users register before being able to take certain actions (for example, posting reviews or commenting) but do not want them to have access to the WordPress Dashboard? Truth is, WordPress User Registration doesn't have to […]

Continue Reading

2 thoughts on “Enable WordPress User Registration on a Subsite Only

    I am using “Theme My Login” and network activated this plugin, but users will still be redirect to the main site for registration.

    Reply

    What this mini plugin does is simply blocks the default signup registration form. So when users click the Theme My Login registration form they get redirected to the homepage.

    What you need is remove the registration link in Theme My Login, and under it, place a link to a register page created with the [wppb-register] shortcode from Profile Builder.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.