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
- Appropriate WP hook to use set PHP cookie
- is_user_logged_in() doesn’t work after custom login and redirect
- Cookies vs. sessions
- How do I expire a PHP session after 30 minutes?
- Is there a way to send HTML formatted emails with WordPress’ wp_mail() function?
- How to get WordPress’ hooks/actions run sequence?
- Where can I find a list of WordPress hooks?
- Is there a save_post hook for custom post types?
- Where is the right place to register/enqueue scripts & styles
- How to know what functions are hooked to an action/filter?
- How to hook update_post_meta and delete_post_meta?
- Are there any hooks that alter the 404 logic?
- Can’t log in: “ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.”
- Difference between do_action and add_action
- WP Cron Doesn’t Execute When Time Elapses
- Login page ERROR: Cookies are blocked due to unexpected output
- WooCommerce: change display order of product short description and price [closed]
- Why do some hooks not work inside class context?
- Preventing session timeout
- Difference between after_setup_theme and init action hooks?
- get $post in init filter or action?
- How reduce wordpress login session timeout time?
- Use wp init hook to call other hooks?
- How many times can I hook into the same action?
- How do I implement the WordPress Iris picker into my plugin on the front-end?
- How to intercept a 404 error
- Move excerpt meta box to above content editor
- Action hook for custom tax edit
- Trigger custom action when setting button pressed
- What is “all” in isset($wp_filter[‘all’])
- Whats worth using add_action when we can simply use add_filter?
- Is there a limit to hook priority?
- Please explain how these hooks work
- How to share cookies and sessions between domain and subdomain?
- Add_action to wp_head via functions.php
- Hook after image is uploaded and image sizes generated
- Hook that fires when admin setting is saved
- add_action(‘wp_ajax_[action name]’, myfunction) problem
- Is it possible to transfer a WordPress session to a different browser via query string?
- WordPress auto login after registration not working
- What is the difference between update_post_meta and update_postmeta hooks?
- wp_set_auth_cookie() doesn’t work in Ajax call
- Hook ‘wp_enqueue_scripts’ priority has no effect
- Hook on trash post
- Hook *after* user password change?
- Auto-retrieve YouTube Image for Thumbnail?
- Which hook if user profile information is updated?
- How to remove action hook done in a plugin from functions.php in my theme?
- Hooks for trashing, deleting, saving, restoring custom post type
- Disable WordPress 3.6 idle logout / login modal window / session expiration
- Is there a WordPress core & plugins update action hook?
- Hook into WordPress update?
- How to pass users back and forth using session data?
- trigger save_post event programmatically
- Implementing advanced add_* function wrappers
- Adding onload to body
- Allow up to 5 Concurrent Login Sessions
- My add_action (wp_footer, ‘method’) is not calling?
- Passing Additional Parameters to add_filter Callable
- Do WordPress Core Filenames Work as Hooks?
- What is the earliest possible hook for safely using `is_front_page`?
- switch_to_blog(): Load textdomain
- How to call a REST endpoint when a post is published?
- How should you hook a session_start() when authoring a plugin?
- __NAMESPACE__ with register_activation_hook
- How to fake a WordPress login?
- Does wp_logout_url() destroy a session? (Logging out question)
- Init action hook running late after PayPal’s return url?
- Can I hook inside another hook?
- Adding function directly vs using hook in function.php
- Are hooks called synchronously?
- How to check if which hook triggered the call to a function?
- How can I send to multiple Contact Form 7 recipients based on form input? [closed]