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:
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.
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.
Related Articles
Beginner’s Guide to: What Is WordPress?
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 ReadingHow to Eliminate WordPress Spam Registrations (Step-by-Step Guide)
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 ReadingWordPress User Registration
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
I am using “Theme My Login” and network activated this plugin, but users will still be redirect to the main site for registration.
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.