As stated in the documentation,
The
$current_user
global may not be available at the time this filter is run. So you should use the$user
global or the$user
parameter passed to this filter.
function my_login_redirect( $redirect_to, $request, $user ) {
// Don't modify the redirect on error.
if( wp_is_error( $user ) )
return $redirect_to;
$myID = $user->ID;
// ...
}
Related Posts:
- Increase of failed login attempts, brute force attacks? [closed]
- How to prefill WordPress registration with social details
- I can’t access my site via wp-admin
- Redirect user using the ‘wp_login_failed’ action hook if the error is ’empty_username’ or ’empty_password’
- wp_signon() does not authenticate user guidance needed
- Disable WordPress 3.6 idle logout / login modal window / session expiration
- How to pass users back and forth using session data?
- Avoid to load default WP styles in login screen
- Integrate recaptcha and wp_signon – what is needed?
- Programmatically log in a wordpress user
- Send reset password link to user from custom lost password form
- Change sign-on URLs for security purposes
- Can’t stop hacker trying to get admin access in WordPress blog after trying many ways [closed]
- Hook for fail and successful login actions
- How long do users stay logged in if they DON’T check remember me?
- How does WordPress track that a certain User is Logged-In
- Admin user getting message ‘You need a higher level of permission’
- Mobile users redirected to a different page on login unless linked to another post
- 2 wordpress blogs with 1 users table and 1 login
- How can i add validation to this login form with out it redirecting to the wp-login.php page
- advance membership managment
- Bootstrap Modal as login page
- Custom login page always redirecting to wp-login.php
- Force users to register in order to view website [duplicate]
- auto login after registeration for wp-members plugin
- Passing username to login screen
- Sniffing wordpress user’s credentials
- How can I do a URL redirection when an user uses wrong login details?
- How to Get Logged-in to “Remote WP Site” from my local script (in Same Browser)?
- v5.6.2 User cannot stay logged in – wordpress_test cookie placed but not auth cookies
- How to set JWT token with PHP on successful login?
- wp-admin redirects to subdirectory after moving installation to subdirectory
- Share WordPress login info with other PHP app
- Facebook login for private group members
- WordPress c-panel login error [closed]
- Locked Out Of WordPress, Can’t Reset Through PHPMyAdmin
- Facebook and WordPress
- Does WordPress (or a plugin) reveal login credentials to admin?
- How can I remove “Powered by WordPress” pop-up disclaimer in wp-login.php?
- User needs to login first before accessing website
- Redirecting after login?
- How can I redirect wp-login.php but still allow logout and other actions?
- Changed the url into https and now can’t access site admin
- Can’t log in. WordPress says my account doesn’t exist [closed]
- Form Action submit over https
- How do I add Login fields and registration link to the header?
- How to make a user be able to register if such a login already exists?
- Can not login to wordpress site after resolving white screen of death
- WordPress on localhost (LAMP) – Can’t login, just redirects to wp-login.php
- add_action(‘init’) not work
- Password not resetting on wordpress?
- WordPress “wp-admin” redirecting to a user account login
- autocomplete=”off” WordPress Login
- Why there is a 302 status when my account and password are right?
- 503 Login WordPress [closed]
- login/logout for only one page
- Password recovery URL has error – but not found in code or db
- Custom login modal page action
- Cannot Get User id after login success in file wp_login.php
- This webpage has a redirect loop issue
- authenticate user without redirecting
- Create front end member login
- Logging in to the frontend works correctly but not for WP-Admin
- I can’t access my wp-admin dashboard
- Unable to login my wordpress website
- Cannot login to WordPress on one device: login refreshes/an error was encountered whilst trying to authenticate
- How to block specific user id in custom login form?
- Make an order of products without login
- Updated : how to make email optional while user registration using default wordpress form
- I can’t log in to `wp-admin` after changing my domain
- My wordpress site crashes when I login!
- End session screen not close automatically after login
- Unable to login with email address as the username – WordPress
- Bypass login page
- Using WordPress login for a non word-press website
- Using is_user_logged_in() to lock down whole site
- wp login password reset
- After moving WordPress to its own directory, login doesn’t work
- WordPress login is not showing , there is warning?
- WordPress Redirect After logging
- Issue logging in from second computer
- Login problem with https
- How to Create a login for for subscribers only
- WordPress auto login user after registration only from a specific page
- Custom Field For Login
- User login without username, only password
- Opening protected page with cookie?
- Login user after registration programmatically
- wp_lostpassword_url not escaped
- Directory authentication initially succeeded, but no valid profile was found (“get entries” procedure)
- External Authentication
- authenticate to another site using a login form on my site
- Trim the repeated value in URL
- Warning: session_start(): Cannot send session cookie – headers already sent by
- Login to wordpress with filezilla client [closed]
- I can’t login to wordpress dashboard without SSH
- Member Area Login with Fail Message
- Username character requirements
- Users cannot log in using popup
- Must Log In to Visit Site [duplicate]