After using the wp_login
hook, is it possible to add a snippet of javascript code to the page seen immediately after the login in wordpress?
I want to use this top implement a notification system that notifies the user when they login.
After using the wp_login
hook, is it possible to add a snippet of javascript code to the page seen immediately after the login in wordpress?
I want to use this top implement a notification system that notifies the user when they login.
You must be logged in to post a comment.
I would do something like this:
Set a never-expiring transient for the user after logging on. If a transient is set for that user, inject some JavaScript code and delete the transient.
The typical method to store pending action in WordPress is to set short-lived transient (
set_transient()
). Since this would need to distinguish between users you can incorporate user info as part of transient key or use different storage API, such as user option (update_user_option()
), instead.