Hiding WP-Login page | WordPress
Using the below code in your functions.php file, you would then only be able to access the WP dashboard by navigating to domain.com/wp-login.php?admin=access.
// Hiding wp-admin and wp-login.php
function protection_for_login_page() {
$QS = '?admin=access';
$theRequest = 'http://' . $_SERVER['SERVER_NAME'] . '/' . 'wp-login.php' . '?'. $_SERVER['QUERY_STRING'];
if ( site_url('/wp-login.php').$QS == $theRequest ) {
echo 'Query string matches';
} else {
header( 'Location: http://' . $_SERVER['SERVER_NAME'] . '/' );
}
}
add_action('login_head', 'protection_for_login_page');