登录Wordpress之前调用自定义功能 [英] Call custom function before login in wordpress
问题描述
我想在使用输入的登录名&登录之前调用自定义函数.密码,如果该函数返回true
,则用户应继续登录.
I want to call a custom function before login using the entered login & password and if that function returns true
than user should proceed to login.
我已经尝试过add_action('wp_login', 'do_anything');
来做到这一点,但是登录后它调用了我的自定义函数.
I have tried add_action('wp_login', 'do_anything');
to do this but it called my custom function after login.
登录前有什么方法可以调用自定义函数吗?
Is there any way to do call custom function before login?
推荐答案
您正在寻找 wp_authenticate 操作挂钩.
You're looking for the wp_authenticate action hook.
此操作位于
wp_signon
内部.与wp_login
操作相反,该操作是在WordPress身份验证过程之前 执行的.
This action is located inside of
wp_signon
. In contrast to thewp_login
action, it is executed before the WordPress authentication process.
您的帖子中没有包含太多信息,但是 wp_authenticate_user 过滤器也可能有用.
You didn't include much info in your post, but the wp_authenticate_user filter may also be useful.
wp_authenticate_user
筛选器挂钩用于在用户每次登录WordPress时执行其他验证/身份验证.
The
wp_authenticate_user
filter hook is used to perform additional validation/authentication any time a user logs in to WordPress.
这篇关于登录Wordpress之前调用自定义功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!