Implement WordPress login protection without installing a plugin

888u

Last update at :2024-03-20,Edit by888u

Yesterday, this site introduced to you the "Tutorial on how to enable Google reCaptcha in WordPress and add verification codes for login, comments, etc." It is naturally very good to use reCaptcha to protect the WordPress login page, but some friends may not like to install too many plug-ins. So today I will share a method to protect WordPress login without installing a plug-in.

1. WordPress login protection without plug-in

The backend login page of WordPress is uniformly /wp-login.php, so what we have to do is to protect this page.

Add the following code to functions.php:

add_action('login_enqueue_scripts','login_protection'); function login_protection(){ if($_GET['user'] !='me') header('Location: http://www.baidu.com'); }

In this way, users who directly access the /wp-login.php login page will be redirected to the Baidu homepage. They must access /wp-login.php?user=me to open the login page normally. This method is also very convenient. Implementation of WordPress login protection.

Note: The parameter me and value user here can be customized.

2. WordPress reCaptcha installation method

We can also implement WordPress protection through plug-ins. The most commonly used one is Google reCaptcha: "Tutorial on opening Google reCaptcha in WordPress and adding verification codes for login, comments, etc."

Recommended site searches: IP detailed address query, virtual host control panel, IP reverse check, Japanese server rental Japanese server, website virtual host space, my IP address web page registration, expired domain name query, overseas host rental, domain name registration Query,

Implement WordPress login protection without installing a plugin

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码