There is an action hook called login_init
. It’s also called on the registration page. You can simply attach wp_die()
to it. You might want to disable the entire backend as well, which can be done by hooking into admin_init
.
add_action( 'login_init' , 'wp_die' );
add_action( 'admin_init' , 'wp_die' );
WordPress will exit with an empty message box.
To leave a message do as follows following:
function go_away() {
wp_die( 'Nice meeting you, byebye.' );
}
add_action( 'login_init' , 'go_away' );
add_action( 'admin_init' , 'go_away' );