I have a theme being used by a sub-folder multisite and a domain-mapped multi site.
E.g.
mywpsite.com/site1
mywpsite.com/site2
www.site2.com (leads to the above)
I have this snippet of code in my functions.php file
function my_wp_admin_ban(){
if( !current_user_can('activate_plugins') ){
wp_redirect( get_bloginfo('url') );
exit;
}
}
add_action('admin_init','my_wp_admin_ban');
This successfully prevents members of site1 from access the admin (wp-admin) dashboard area.
This code does not, however, seem to work for site2.
Instead, those users are shown a "You do not have sufficient permissions to access this page." error message.
Tried everything I can think of including different ways of doing the same thing I.e. How to redirect non admins to homepage if trying to view mysite.com/wp-admin/? and How do I remove dashboard access from specific user roles?
What can I do to ensure all users (non admin) of the multisite are redirected away from the dashboard area?