Restrict users on multisite WordPress install

Use is_user_member_of_blog() to check if the current user has been assigned to the blog in wp-admin/network/site-users.php. Then hook into template_redirect and run the test:

add_action( 'template_redirect', function() {

    if ( ! is_user_member_of_blog() )   
        die( 'Please ask the network administrator to get access to this blog.' );
});

Leave a Comment