If you need to block user login at WordPress, especially if you wish to block login for the group of users, you may assign them special empty role, created with the help of “User Role Editor”. Let’s name it “block-login”, for example. “Empty” means that role does not contain any capability. Role Editor include the ‘read’ capability into new role by default. Turn it off in order to get empty role. It’s easy, right? But user with empty role will see the message “You do not have sufficient permissions to access this page” at empty grey background after every login try.
Is it possible to make this blocking more user friendly, if this action could be named user friendly at all? The answer is “Yes”.
Add code below to your active theme file functions.php
: Read more Block user login