简体   繁体   中英

Wordpress WP_Login

I'm trying do get a java mesage after login in wordpress. 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. Why does the wp_login not working ?

The wp_login action hook is triggered ONLY when a user logs in by the wp_signon() function. It is the very last action taken in the function, immediately following the wp_set_auth_cookie() call.

See the documentation here and here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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