You can’t access the $_COOKIE in this hook. You can only access $_COOKIE after the page HTTP headers are set with the $_COOKIE its mean in the next page.
You have other hook that you can hook into to get the cookies in the function wp_set_auth_cookie() there is this action at the end.
do_action( 'set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in', $token );
So you can use it like this:
add_action('set_logged_in_cookie', 'custom_get_logged_in_cookie', 10, 6);
function custom_get_logged_in_cookie($logged_in_cookie, $expire, $expiration, $user_id, $logged_in_text, $token) {
// do something...
}
Related Posts:
- Is there a hook that runs after a user logs in?
- Removing username from the ‘wordpress_logged_in’ cookie
- Is there a hook before the user is authenticated?
- Run javascript code after wp_login hook?
- How can I do customizations on login, registration and password recovery forms?
- Setcookie works on admin but not front end
- after login that will redirect user role into a page
- Searching hook to set cookies before and avoid “headers already sent”
- How to get login data (session) outside WordPress?
- Firing a function AFTER redirect
- Setting Cookie with init hook causes ‘header already sent’
- Custom action on login and “remember me”
- External Authentication, session_tokens not destroyed on logout
- PHP header() gives headers already sent
- Send along login credentials with comment content
- Is it possible to add the_content filter upon login?
- One time login on 2 different WordPress sites
- How to read and write session data?
- Session management issues with WordPRess 404 Error page
- Login issue with subdomain installs
- Get WordPress logged in username from root domain when WP is installed in a subfolder
- Updating user meta data from external link, user not logged in
- Cookie cant be read even cookie is present
- Why WordPress not logout after I have close my browser?
- How to add a new link to the default register form’s footer links?
- Does wp_login hook fire on user registration?
- Changing login url
- is_user_logged_in() doesn’t work after custom login and redirect
- add_action(‘wp_ajax_[action name]’, myfunction) problem
- wp_set_auth_cookie() doesn’t work in Ajax call
- Hook on trash post
- Adding onload to body
- What is the earliest possible hook for safely using `is_front_page`?
- Does wp_logout_url() destroy a session? (Logging out question)
- Send data to 3rd party api with wp_remote_post on wp_login
- How to customize the WP admin default help contents
- deactivated_plugin hook: get the name of the plugin
- Is there a hook for user activation (after they click the email confirm)?
- Adding body class to login page?
- How to hook into user registration process Before user registers
- WP Admin Bar frontend issue with dashicon deregister
- A good way to add a different background image for each page?
- Searching a hook which triggers when deleting a post to get all comments
- add_action for lost_password or modify wp-login.php?action=lostpassword
- Custom Connect to Facebook, problem logging in/logging out
- @wordpress/hooks use to add actions/filters within multiple plugin
- How can I customize the upload error message in WordPress?
- WordPress hook that gets featured image from direct URL?
- WP CLI Get all Enqueued Scripts and Styles
- Change username before login
- Delay an action until current action is completed
- How to properly setup an activation hook
- How to remove scripts/style added to customize_controls_enqueue_scripts hook by current active theme
- How to remove query string from current page URL?
- Plugins rewrite rules the right way
- Strange behaviour with add_{$meta_type}_metadata | add_post_metadata filter
- How can I get my Script to work on the Login page?
- Add nofollow to custom widget posts
- Change Password Confirmed Email Text
- Session Experies and Get Logged Out Within Few Minutes
- Lock user information once fields have been filled in
- load-* hook for dashboard
- What conditions must be met in order to upload .zip file to a multisite WordPress installation?
- How to hook code in ?
- wp_enqueue_script before wp_head
- Use an array of page template slugs and $hook
- Session Cookie security questions
- wp_logout hook never triggered
- add short description under price
- How do I use pre_option_{option_name} correctly?
- WordPress media library allow uploading fake file
- Hooking dynamic/variable named hook in all cases
- What hook to add at start of WordPress load
- Knowing if a post is sticky in the ‘save_post’ action. Where do I have to hook?
- Count when a post of a custom post type is deleted and store it in a theme option
- Can we change the hook firing sequence?
- Intercept loading of a certain page
- Creating custom post on registration in wordpress?
- Display custom user profile fields in wordpress
- profile_update not supplying old data
- Output Redirect Headers on Admin Dashboard Page
- add_image_size not working with after_switch_theme
- wordpress hooks
- Check when a setting has been changed
- add extra parameter in default hook in wordpress
- Exclude WooCommerce terminations from YOAST
- set_post_format called after wp_update_post when using bulk edit?
- add hook restricted only to either plugins or themes?
- How to hook watchdog script for existence of a WP page?
- addaction hook cause redirection problem
- White screen after login attempt
- Changing user_login ends current session
- Getting all post/page IDs related to a soon-to-be-deleted tag/cat
- Hooking get_pages()
- Transform .wp-video to the native video player of the browser
- Create a Custom Login System in WordPress [closed]
- How to use the password_reset hook to validate new password and display error
- WordPress keep logged in after browser close
- Get post ID before add_theme_support
- Is there a way to assign a default Category to a Post when the user creates a new Post?