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
- How to check if a user exists by a given id
- Use author author display name in permalink structure for pages and posts
- Get a list of all available fields in the User Profile
- Where and how to put inline js in pages
- Logout redirect to current page – function
- 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
- Add new user : make the fields First Name and Last name required
- 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
- Displaying a random user with a shortcode
- Enqueuing External Javascript functions.php
- How to update BuddyPress xprofile fields programmatically? [closed]
- 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
- How can I add an image field to BuddyPress Extended Profile Fields? [closed]
- Create dropdown of users in admin dashboard
- 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?
- jquery won’t load in footer
- Remove the deleted users avatar from list
- How to properly add NPM packages and integrate them in WordPress?
- How to filter a table in post content without plugins? [closed]
- How to get the post_name when in preview?
- How to add custom fields to my custom registration form
- Replace menu links with # and add name to its li
- wp_is_mobile dequeue not working
- Why won’t my scripts load?
- create shortcode to list users with specific meta key value
- 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?
- Execute a ultimate member action when user role is updated
- 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]
- Including a specific Javascript Script in a template. Is my code correct?
- Change label for registration Fields
- How to search using ajax for exact phrase or words in an input field?
- how to en-queue jQuery to load before the tag
- 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
- Condition OR for current user ID
- I have problems with loading javascripts
- Adding javascript to functions.php causes problems with my template
- Dequeue script to prevent javascript event conflict on wordpress child theme
- javascript and css links not working on sever
- 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
- Why get_user_by() doesn’t work in my code?
- Filter to wp_list_authors
- Enable right click on WordPress site
- The correct way to add a JavaScript in the functions.php [closed]
- Javascript not loading after the document ready
- Theme JS is available but theme CSS isn’t
- How to add array [closed]
- 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?
- get USER ID in functions.php using user_register action
- How do I get my nav menu to show sub pages?
- Why wp_ajax hooks doesn’t work?
- new to javascript – using in instead of functions.php, not loading correctly
- comment_post function with js not running
- Whats the proper way to add a new user via a front end form?
- Animated Accordion [closed]
- Get all users from role and add to dropdown (select) – wordpress, javascript
- Can’t find function which is called in a wordpress theme
- dynamically import array from another js file in WordPress
- WordPress enque the same script causes the setInterval not to work
- iOS and ajaxComplete
- sort by date in users
- How to use webpack in WordPress theme? I want some scripts to load in the footer, some in the header and some with script parameters
- Second featured image only shows in metabox preview after saving a post in the wordpress editor
- Add custom css to specific user
- Help with adding fullcalendar.io to a WordPress page
- Function to filter numbers from string