Automatically add a registered user on the wordpress multisite network even to just one other site

I’ve been searching for a while on the net but with no luck, how can I automatically register the user who registers to the network directly also in the site example.com/account/?

There are 3 sites installed in my WordPress multisite:

  1. example.com/
  2. example.com/account/
  3. example.com/go/

How can I automatically register the user only on the account site?

The following code works for me:

add_action( 'wpmu_activate_user', 'myplugin_registration_save', 10, 1 );
function myplugin_registration_save( $user_id ) {
    $blog_id = 13;
    add_user_to_blog($blog_id, $user_id, "subscriber");
}

answered Jan 11, 2022 at 13:44

Matteo Feduzi's user avatar

Matteo Feduzi

source : https://wordpress.stackexchange.com/questions/401213/automatically-add-a-registered-user-on-the-wordpress-multisite-network-even-to-j


Posted

in

by

Tags:

Comments

Leave a Reply

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