WP Plugin: Access Wordpress Login only with valid IP or GETpass function

WP Plugin: Access WordPress Login only with valid IP or GETpass function

Hello you,

I once found a script for a WordPress login lock. Since the login should only be possible from a specific IP, right
if you come via a specific link: https://website.de/wp-login.php?pass=passwort.

Unfortunately, I have no idea and the password link does not work for me if I want to log in from a different IP address.
Can someone tell me where the error is in the script?

Thank you and have a nice Saturday!

Description: Nur IP oder ein bestimmtes Passwort
function sendthemhome_login_guard() {
if ( $_SERVER['REMOTE_ADDR'] == '') return;
if ( md5( $_GET['pass'] ) == 'MD5-Passwort' ) return;
$info = count($_POST) ? "nnPOST-Vars:n" . print_r($_POST, 1) : '';
$info .= count($_GET) ? "nnGET-Vars:n" . print_r($_GET, 1) : '';
'http://www.utrace.de/?query=' . $_SERVER['REMOTE_ADDR'] . $info
header( 'Location: http://localhost' );
add_action('login_init', 'sendthemhome_login_guard');

Previous post 5 simple rules for WordPress login security
Next post 4 tips to customize the admin and login area of ​​WordPress