Sunday, 20 September 2015

Disable registration link from wp-login page wordpress


Disable registration link from wp-login page wordpress

In my wordpress blog many fake users come and register in my blog without any purpose so i decided to disable registration link from wp-admin. I have used below code to disable register page.

Just put below code in functions.php of your theme

add_filter('option_users_can_register', disable_register);

function disable_register() {
    $script = basename(parse_url($_SERVER['SCRIPT_NAME'], PHP_URL_PATH));

    if ($script == 'wp-login.php') {
        $value = false;
    }

    return $value;
}

No comments: