If you read about this action here.
You will see that this hook provides access to two parameters, $user->user_login (string)
and $user ( WP_User
).
Using it like this you will see all the info you have access to:
function add_to_login($user_login, $user)
{
echo "<pre>".print_r($user, true)."</pre>";
}
add_action('wp_login', 'add_to_login', 10, 2);
But after a little testing I don’t see how you can use this info with your JS as the user is immediately redirected after this action. Your script won’t have time to do anything.
Related Posts:
- Adding fields to the “Add New User” screen in the dashboard
- Use author author display name in permalink structure for pages and posts
- Get a list of all available fields in the User Profile
- How to paginate the get_users function?
- Does WordPress Development Mode Exist (with not minified JS)?
- How to display random users with avatars
- How to manually activate user in dashboard only by admin
- Apply jquery script to only woocommerce product pages and categories
- wp_delete_user with username
- Change labels on ‘Nickname’ and ‘Biographical Info’ in user-edit.php
- Order get_users() by last login date. Is it possible?
- How can I tell when a user is logged in?
- Run Product Filter Javascript On Page Template
- how to get and display logged in user’s recently read posts
- Enqueuing External Javascript functions.php
- How to enqueue JavaScript for specific WordPress pages only?
- How to detect first visit of a user?
- Defer all js except certain ones in functions.php file
- Enqueuing Script in functions.php vs on the page
- Can I pass two roles to the function get_users?
- Properly applying nonce to a form using AJAX
- Clean-up script tags
- password protected post policy
- Search user metadata with checkboxes via ajax (almost working)
- wp_enqueue JavaScript in child-theme (ReferenceError) using Search & Go
- Why is my Gutenberg block returning an error after initial save?
- Remove the deleted users avatar from list
- How to filter a table in post content without plugins? [closed]
- How to add custom fields to my custom registration form
- wp_is_mobile dequeue not working
- Why won’t my scripts load?
- Loading CDN that requires jQuery in WordPress
- How to hide unused profile fields?
- wp_register_script(… $in_footer = true) not working
- Don’t delete a page if it holds users
- How to make custom column Admin>Users sortable?
- Scripts not appending to element in AJAX call – why?
- Filter out other users comments. Visualize only own comments and editor role users’ comments
- call of javascript function to external url always blocked by cors
- Force to use STRONG users password and implement rule to prevent REUSE [closed]
- Change label for registration Fields
- How to search using ajax for exact phrase or words in an input field?
- Overwriting the menu break points of twentysixteen in child theme
- How do I remove the date and category form my portfolio pages
- I can’t enqueue my scripts – They literally aren’t being added to my site
- adding custom script to functions file
- Javascript function not working when placed in Text Block
- Run a jquery script on on a certain template page
- How to Use Global Variables Inside Header and Footer
- Secondary Menu and Logged In Users
- Enable right click on WordPress site
- The correct way to add a JavaScript in the functions.php [closed]
- Theme JS is available but theme CSS isn’t
- Auto scroll to id on page load on all pages except home page. Only do this on mobile
- Add Link to Users List (Backend) to open each users front-end profile
- Need help with customalert that it would read on a normal page, but not in WordPress
- How to load jQuery in TOP of wp_footer?
- Suggest Users basing on User taxonomy
- Include Jquery libraries in wordpress theme?
- Showing user profile data on front-end
- Linking Javascript in functions.php file
- Dequeue scripts in IE7 only using functions.php
- User meta and public function security
- call wp_insert_user in custom class doesnt work
- Creating a custom wordpress widget and stopping js from running twice(once in active widget once in widget selector)?
- How to setup a popup registeration page in wordpress with function.php
- How can I show different content for different user-levels?
- Custom user role still showing up after deletion, ideas?
- referencing the current user in a page i created in wordpress
- How to change text color depending on the number value (Using javascript)
- Add custom taxonomy using JS in post editor
- wp_set_object_term via js btn frontend
- localize_script but data changes dependent on product ID
- Display Script in Header When URL Variable Present
- wp_get_current_user return ID = 0 when used outside of wordpress, such as webhook / fulfillment dialogflow
- Allow user only create specific tags
- Add Change role button for list of user in an event
- Ajax in plugin fails – but only on one blog – no idea why
- get_current_user_id() always return 0 in if else statement
- How to add javascript code into Divi child theme?
- Help wiht adding fullcalendar.io to a WordPress page
- Multiple Notifications SetInterval
- Show users last read posts for each user?
- admin-ajax.php & my wp-admin folder url showing in header
- wordpress ajax is not working for dropdown selection
- Javascript and Stylesheet in child page
- How to add number to wordpress count function?
- Using wp_localize_script in template file – is it secure?
- Search and Replace Script Loader in Head Only Works in Footer
- custom post with loading script per single post
- Why are some custom javascript files working but some are not
- WordPress Javascript Widget jQuery Dependency Issue
- java script error Uncaught SyntaxError: Unexpected token ILLEGAL
- get USER ID in functions.php using user_register action
- new to javascript – using in instead of functions.php, not loading correctly
- comment_post function with js not running
- Animated Accordion [closed]
- Can’t find function which is called in a wordpress theme
- dynamically import array from another js file in WordPress
- sort by date in users