wp_authenticate()
just checks user data, but not actually authenticating – docs.
You can use wp_signon
, which uses and wp_authenticate
: source, like this:
$credentials = [
'user_login' => $name,
'user_password' => $password,
'rememberme' => true,
];
$signon = wp_signon($credentials, true); // true - use HTTP only cookie
if(is_wp_error($signon)){
return false;
}
// The user is logged in redirect, return true, etc.
Related Posts:
- Use WordPress with a custom OAuth2 provider
- How to save generated JWT token to cookies on login?
- Possibility to login without password
- Why does WordPress use cookies for /wp-admin and /wp-content/plugins for non-admin users [duplicate]
- WordPress ReAuth =1 Loop with wpCAS
- Advice on setting up private site
- Change All Login/Signup Links in Plugin
- Login with OpenID, similar to Stack Exchange sites?
- How can I log a user out of WordPress before the page loads?
- Change success message in plugin Theme my login
- How to get Login Error messages on a custom template
- How to authenticate custom API endpoint in WooCommerce [closed]
- How to assign user a role if none is present when logging in
- How can a Firebase user registration and login be integrated into a WordPress site?
- How do you import members from another system to WordPress and update passwords so they’ll work?
- How to get user-meta from Social Login registered users?
- Auto login using Active Directory and Windows Authentication
- Security error WP 4.0 + WP phpBB Bridge [closed]
- Which hook should be used to validate custom form fields on the login form?
- How can I make content disappear when a user logs in?
- How to create custom LOGIN and REGISTRATION forms?
- Tracking last login and last visit
- login to wordpress with Get variables instead of Post
- Prevent Brute Force Attack
- Login with email (WP Modal Login)
- Check if the front end user is log in or not
- wordpress custom login successful redirect hook
- How to create a word press user with hashedpassword
- WordPress with CAS+LDAP and standard WP accounts
- WordPress login with Phone Number [closed]
- Force [wordpress_social_login] shortcode to display where it is embedded [closed]
- Cannot login to ADMIN even after changing password in phpmyadmin
- How do i login when i cant access wp-login.php?
- Why is my staging subdomain not sending wordpress_logged_in cookies?
- Single central login for front end users from any site
- How can I force users to a particular subdomain to log in for MU (Multisite)?
- Plugin: Google Analytics for Dashboard error – Timestamp is too far from current time
- “Request has expired” with “Make your site social” (Gigya) plugin
- how to oauth1 Wp plug-in revoke/reset.?
- Contributive page where people logged in can write
- Why can’t I access my Intranet LDAPS with NADI?
- Login cookies set as wrong domain
- Login Customizer doesn’t change the background of the register form
- Login problem after installing my written plugin [closed]
- Too many login attempts
- Get ‘Headers already sent’ error for the plugin I am creating when I try to login
- Custom Login Page — wp_signon Headers Already Sent?
- What am is missing? (API CORS)
- how do i change my website facebook login button to another text immediately user login? [closed]
- WordPress unable to write files in the server
- Custom PHP Page Using WordPress login
- How to Use the Filter “sidebar_login_widget_form_args”
- Manage PDF downloads and protected pages
- If I use an alternative login (e.g. CAS or other SSO) plugin, is my site protected from the recent brute force login attempts?
- login in wordpress using gmail account
- How can I replace content on site generated from plugin without changing plugin
- Janrain/Simple Modal under Redirected Domain
- Linking form to user meta fields
- WordPress Multisite Profile Picture Sync Error with Nextend Social Login Plugin
- Plugin or ways to limit number of users logging in the website,
- force logged in user to stay in the dashboard
- create pages automatically and dynamically in wordPress
- Share login credential with QR code
- Which membership plugin for a simple sign in? Personal areas for customers
- Discern a specific plugin’s action hooks
- prevent anonymous access to WordPress site (non-admin site)
- Login/password protected “client page”
- WordPress Admin login redirect to homepage
- How can I upload and password protect Javadocs in WordPress?
- https rewrite not working for All in one security Brute force > rename login url
- On button click, redirect users to registration page instead of another page
- When the user entered an unauthorized url redirect to login page
- How to show private pages based on a user’s role?
- using wordpress login details for other website / application / forum?
- wp_signon returns user, in popup window, but the user is not logged in
- How to Create Custom Dashboard for my Laundry Website?
- wp_login_form() ignoring login_form action hook
- User content database [closed]
- AJAX login without a plugin does not work. when add a action to function.php
- Plugins effecting layout & login
- Redirect default login page to a custom page [duplicate]
- wp-admin will not redirect to wp-login.php
- Adding google authenticator and use only email address of user
- Adding a Filter to Sidbar Login Plugin to Change Login Button Lable
- First argument is expected to be a valid callback for cp_admin_init and _canonical_charset
- how to protect wordpress website
- HTTP Error 403 When Trying to Login
- Checking url from plugin [duplicate]
- What plugin(s) are best for this User registration task? [closed]
- Trouble Removing Plugin [closed]
- How do I to override login redirect on specific pages?
- plugin for different writers [closed]
- How to resolve these findings from security audit
- ERROR: Cookies are blocked due to unexpected output – no access to FTP
- How to Find WordPress site has backdoor login Codes
- How to create a custom wordpress plugin for a specific functionality?
- Social login authentication via wordpress rest api
- WordPress Homepage Login
- I cannot login after installing the wp-login timeout setting plugin
- WordPress User Registration/ Sign Up -> Able to take Paid Certification Courses & keep track of Completed Certificates