I’m not a professional but maybe you can add a restriction in the code? I might do the same with my site using Ultimate Member. I will only have 1 or 2 admins and not planning to make more. If I do though, I’ll just edit the code maybe.
ChatGPT gave me this code. I would like to ask the devs if this code will help or not? Thanks.
function restrict_admin_access() {
// Get the current user
$user = wp_get_current_user();
// Check if the user is logged in and their email is not allowed
if (is_user_logged_in() && !in_array($user->user_email, array('[email protected]', '[email protected]'))) {
wp_logout(); // Log out the user
wp_safe_redirect(home_url()); // Redirect to the homepage or another appropriate page
exit();
}
}
add_action('init', 'restrict_admin_access');
Edit: This code will still let malicious attackers create admin accounts, but it will prevent them from using the admin page I hope….
-
This reply was modified 1 year, 7 months ago by sunapitan.