We’ll share it with the big guy.Hide a tutorial to login address on WordPress backstageHowever, it was felt that hiding backstage alone was not safe and this time the big head shared a method of adding authentication codes to WordPress login in order to further enhance website security.

Add authentication code:
//后台登陆数学验证码开始
function myplugin_add_login_fields() {
//获取两个随机数, 范围0~100
$num1=rand(0,100);
$num2=rand(0,100);
//最终网页中的具体内容
echo "<p><label for='math' class='small'>验证码: $num1 + $num2 = ?<input type='text' name='sum' class='input' value='' size='20' tabindex='4'>"
."<input type='hidden' name='num1' value='$num1'>"
."<input type='hidden' name='num2' value='$num2'></label></p>";
}
add_action('login_form','myplugin_add_login_fields');
function login_val() {
$sum=$_POST['sum'];//用户提交的计算结果
switch($sum){
//得到正确的计算结果则直接跳出
case $_POST['num1']+$_POST['num2']:break;
//未填写结果时的错误讯息
case null:wp_die('提示: 请输入验证码.');break;
//计算错误时的错误讯息
default:wp_die('提示: 验证码错误,请重试.');
}
}
add_action('login_form_login','login_val');
//后台登陆数学验证码结束
Copying this paragraph above to the bottom of the WordPress template function functs.php files allows you to add back-office login authentication codes.
Factions.php file location: WordPress background…>Appearance…>Theme Editor ->functions.php
未经允许不得转载:萌萌Apprentissage » Add the Wordpress backstage login code to one move.
Learn html_How websites work
WordPress Summary of Moving Methods: Migration of Hosts and Replacement of Domain Names
How to set auto-optimize auto-autoptimize plugins for your WordPress site
Installation and use of llinux environmentnode.js and npm install