简体   繁体   English

WordPress的WP_Login

[英]Wordpress WP_Login

I'm trying do get a java mesage after login in wordpress. 我正在尝试在wordpress中登录后获取Java消息。 Here is my code: 这是我的代码:

function myFunction()
{
?>
<script>
alert('test');
</script>
<?php
}

add_action( 'wp_login', 'myFunction' ); 

I had a sidebar login widget. 我有一个侧边栏登录小部件。 If i replace wp_login with get_header it works. 如果我用get_header替换wp_login,它可以工作。 Why does the wp_login not working ? 为什么wp_login不起作用?

The wp_login action hook is triggered ONLY when a user logs in by the wp_signon() function. 当用户通过wp_signon()函数登录时,才会触发wp_login操作挂钩。 It is the very last action taken in the function, immediately following the wp_set_auth_cookie() call. 这是函数中紧接wp_set_auth_cookie()调用后执行的最后一项操作。

See the documentation here and here . 请在此处此处查看文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM