Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Login with email (WP Modal Login)

I’m using this simple action, and it works like a charm. 🙂

<?php
/** Plugin Name: (#111223) User Login with Mail Address */
    add_action( 'wp_authenticate', 'wpse111223_login_with_email_address' );
function wpse111223_login_with_email_address( $username ) {
    $user = get_user_by_email( $username );
    if ( ! empty( $user->user_login ) )
        $username = $user->user_login;

    return $username;
}

It hooks to wp_authenticate and enables email login to the WordPress Authentication system, so it should work with any plugin. I use it successfully with Login with Ajax plugin.

🙂

Later-edit: For those who don’t know where to put the snippet of code, it should go in your theme’s functions.php or a custom plugin.

Related Posts:

  1. WordPress login with Phone Number [closed]
  2. Possibility to login without password
  3. Redirect default login page to a custom page [duplicate]
  4. Login with OpenID, similar to Stack Exchange sites?
  5. How can I make an Ajax login form work with FORCE_SSL_ADMIN enabled?
  6. Change success message in plugin Theme my login
  7. How to get Login Error messages on a custom template
  8. How can a Firebase user registration and login be integrated into a WordPress site?
  9. How to get user-meta from Social Login registered users?
  10. Auto login using Active Directory and Windows Authentication
  11. Which hook should be used to validate custom form fields on the login form?
  12. How can I make content disappear when a user logs in?
  13. How to create custom LOGIN and REGISTRATION forms?
  14. Tracking last login and last visit
  15. login to wordpress with Get variables instead of Post
  16. Prevent Brute Force Attack
  17. Check if the front end user is log in or not
  18. wordpress custom login successful redirect hook
  19. How to create a word press user with hashedpassword
  20. WordPress with CAS+LDAP and standard WP accounts
  21. Is there any good tutorial to write custom login, registration and password recovery forms? [closed]
  22. Use WordPress with a custom OAuth2 provider
  23. Cannot access wp-admin after disabling all plugin
  24. wp_authenticate but not logged in
  25. Force [wordpress_social_login] shortcode to display where it is embedded [closed]
  26. Cannot login to ADMIN even after changing password in phpmyadmin
  27. How do i login when i cant access wp-login.php?
  28. Why is my staging subdomain not sending wordpress_logged_in cookies?
  29. Single central login for front end users from any site
  30. Is there an earlier hook than login_head or login_enqueue_scripts?
  31. How can I force users to a particular subdomain to log in for MU (Multisite)?
  32. Plugin: Google Analytics for Dashboard error – Timestamp is too far from current time
  33. “Request has expired” with “Make your site social” (Gigya) plugin
  34. How to save generated JWT token to cookies on login?
  35. Redirect already logged in users away from a page to a specific page base on user role
  36. Contributive page where people logged in can write
  37. Login cookies set as wrong domain
  38. How to use login_redirect with a user capability
  39. Login Customizer doesn’t change the background of the register form
  40. Enqueue stylesheet in plugin for wp-login.php
  41. easy steps to make front end form without plugin
  42. Change wp-login to custom URL login page
  43. Login problem after installing my written plugin [closed]
  44. Too many login attempts
  45. Get ‘Headers already sent’ error for the plugin I am creating when I try to login
  46. Custom Login Page — wp_signon Headers Already Sent?
  47. Theme My Login Shortcode Doesn’t Return Anything
  48. how do i change my website facebook login button to another text immediately user login? [closed]
  49. WordPress unable to write files in the server
  50. Custom PHP Page Using WordPress login
  51. How to Use the Filter “sidebar_login_widget_form_args”
  52. Manage PDF downloads and protected pages
  53. If I use an alternative login (e.g. CAS or other SSO) plugin, is my site protected from the recent brute force login attempts?
  54. login in wordpress using gmail account
  55. How can I replace content on site generated from plugin without changing plugin
  56. Janrain/Simple Modal under Redirected Domain
  57. Linking form to user meta fields
  58. WordPress Multisite Profile Picture Sync Error with Nextend Social Login Plugin
  59. Plugin or ways to limit number of users logging in the website,
  60. force logged in user to stay in the dashboard
  61. Share login credential with QR code
  62. Which membership plugin for a simple sign in? Personal areas for customers
  63. Discern a specific plugin’s action hooks
  64. wp_set_password() does not work!
  65. Login/password protected “client page”
  66. WordPress Admin login redirect to homepage
  67. https rewrite not working for All in one security Brute force > rename login url
  68. On button click, redirect users to registration page instead of another page
  69. How can I show login popup when user clicks on download button
  70. When the user entered an unauthorized url redirect to login page
  71. How to show private pages based on a user’s role?
  72. Why does WordPress use cookies for /wp-admin and /wp-content/plugins for non-admin users [duplicate]
  73. using wordpress login details for other website / application / forum?
  74. wp_signon returns user, in popup window, but the user is not logged in
  75. How to Create Custom Dashboard for my Laundry Website?
  76. wp_login_form() ignoring login_form action hook
  77. User content database [closed]
  78. Auto-login from backend
  79. AJAX login without a plugin does not work. when add a action to function.php
  80. Plugins effecting layout & login
  81. wp-admin will not redirect to wp-login.php
  82. Adding google authenticator and use only email address of user
  83. Adding a Filter to Sidbar Login Plugin to Change Login Button Lable
  84. First argument is expected to be a valid callback for cp_admin_init and _canonical_charset
  85. how to protect wordpress website
  86. WordPress ReAuth =1 Loop with wpCAS
  87. HTTP Error 403 When Trying to Login
  88. Advice on setting up private site
  89. Checking url from plugin [duplicate]
  90. What plugin(s) are best for this User registration task? [closed]
  91. Trouble Removing Plugin [closed]
  92. Change All Login/Signup Links in Plugin
  93. How do I to override login redirect on specific pages?
  94. How to link that “logged in” in “you must be logged in to post a comment” with custom login page on WordPress?
  95. plugin for different writers [closed]
  96. How to resolve these findings from security audit
  97. ERROR: Cookies are blocked due to unexpected output – no access to FTP
  98. How to validate password length in wordpress
  99. How to Find WordPress site has backdoor login Codes
  100. How to create a custom wordpress plugin for a specific functionality?
Categories plugins Tags login, plugins, wp-login-form
How to insert category and subcategory using ‘wp_insert_post’ function?
List custom post type but redirects to home page

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress