用来检查登录信息的php文件在哪里?

时间:2016-06-06 作者:Snowman

我想在我的wordpress网站的用户名和密码验证功能中为特定用户名添加一些额外的检查,但我找不到正确的php文件。。。

/* I would like to do something like this */
if ($username == "testuser_with_no_rights") {
    /* ... */
}
else { 
    /* do everything as it was defined originally */ 
}
所以,基本上,where is the php file, that does the checks for login information?

也有可能有更好的方法来做到这一点。如果是这样的话,我也愿意接受建议

1 个回复
SO网友:TomC

你不想在这件事上胡闹。查看以下挂钩:https://codex.wordpress.org/Plugin_API/Action_Reference/wp_login

您应该这样做:

function check_test_user() {
// Your code here
}

add_action(\'wp_login\', \'check_test_user\');
钩子将作为登录过程的一部分运行,并保存您修改的核心Wordpress文件。

相关推荐

Content-Security-Policy标头存在并显示正确的设置,但仍收到拒绝的连接

所以我把一个插件放在一起,它允许我用一个在线服务连接多个客户端站点。我可以让服务供应商代码段加载,但一旦你与它交互,事情就会变得棘手,它拒绝加载(我猜)iframe。。。它的文档记录很差。Refused to load https://www.service-domain.com/ because it does not appear in the frame-ancestors directive of the Content Security Policy.这是我收到的控制台日志错误。因此,我跳回插件