Many WordPress sites don’t need to offer the option for users to register and often find spam users created which clog up your database and can cause problems down the line. Most spam users will register on your WordPress website by using the default register link found on the login screen, this can easily be removed which will reduce the number of spam user registrations on your website.
To remove the register link from the WordPress login.php screen you will need to add a small function to your theme functions.php file or create a WordPress MU plugin. We recommend using an MU plugin as this will be used no matter what theme you use and can’t be deactivated by accident by other site administrators.
Function to remove the register link from WordPress login.php
/**
* Remove the register link from the wp-login.php script
* https://wphelper.io/remove-register-link-wordpress-login/
*/
add_filter('option_users_can_register', function($value) {
$script = basename(parse_url($_SERVER['SCRIPT_NAME'], PHP_URL_PATH));
if ($script == 'wp-login.php') {
$value = false;
}
return $value;
});
This function will remove the register link completely which is a better method than removing the link with CSS. If you remove the link using CSS most bots will still find it as they will crawl the page HTML ignoring the CSS.
If you get stuck with adding this function to your site please leave a comment below or contact us.
For more information on removing the register link from the WordPress Login, let us help you accordingly, from start to finish, with one-Time fixes, custom plans, or monthly routines for your WordPress website.