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

Show errormessages on wrong username/password on custom loginform?

Why do you not use the default function wp_login_form() for the login form, example:

global $user_login;

if (is_user_logged_in()) {
    echo __( 'Hello', 'theme_text_domain' ) . $user_login . '<a href="' . wp_logout_url() . '" title="' . __( 'Logout', 'theme_text_domain' ) . '">' . __( 'Logout', FB_BASIS_TEXTDOMAIN ) . '</a>';
} else {
    wp_login_form();
}

the function and his params, more information on the codex

wp_login_form(array(
    'echo' => true,
    'redirect' => site_url($_SERVER['REQUEST_URI']), 
    'form_id' => 'loginform',
    'label_username' => __('Username'),
    'label_password' => __('Password'),
    'label_remember' => __('Remember Me'),
    'label_log_in' => __('Log In'),
    'id_username' => 'user_login',
    'id_password' => 'user_pass',
    'id_remember' => 'rememberme',
    'id_submit' => 'wp-submit',
    'remember' => true,
    'value_username' => ,
    'value_remember' => false
))

Related Posts:

  1. wp_enqueue_script was called incorrectly
  2. How to change login labels
  3. Secondary Menu and Logged In Users
  4. error at login page in wordpress
  5. loginout function customization
  6. Unable to login after registration
  7. Redirect after login to current URL
  8. wp_login_form display no styled form
  9. Remove type attribute from script and style tags added by WordPress
  10. Adding fields to the “Add New User” screen in the dashboard
  11. How to check if a user exists by a given id
  12. Is there a is_user_logged_in() for multisite?
  13. Use author author display name in permalink structure for pages and posts
  14. Get a list of all available fields in the User Profile
  15. Logout redirect to current page – function
  16. How to paginate the get_users function?
  17. How to display random users with avatars
  18. Masking logout URL
  19. How to manually activate user in dashboard only by admin
  20. Add new user : make the fields First Name and Last name required
  21. Logout/login redirect CSS issue
  22. How can I tell if I’m on a login page? [duplicate]
  23. Is it possible to use a forgot password url filter?
  24. wp_delete_user with username
  25. How to display error messages using WP_Error class?
  26. redirect wp-login.php to another page
  27. Change labels on ‘Nickname’ and ‘Biographical Info’ in user-edit.php
  28. Order get_users() by last login date. Is it possible?
  29. Login using the password from protected pages
  30. Remove Menu Page Giving Error
  31. How can I tell when a user is logged in?
  32. How do I redirect upon login a specific user based on role?
  33. Logging in redirects to correct page but shows logged out content until forced refresh
  34. how to get and display logged in user’s recently read posts
  35. Displaying a random user with a shortcode
  36. How to update BuddyPress xprofile fields programmatically? [closed]
  37. How to detect first visit of a user?
  38. Functions.php reverted to new one
  39. Can I pass two roles to the function get_users?
  40. How can I add an image field to BuddyPress Extended Profile Fields? [closed]
  41. Remove default user registration, login and subscriber profiles
  42. Create dropdown of users in admin dashboard
  43. password protected post policy
  44. Why is my Gutenberg block returning an error after initial save?
  45. is_user_logged_in not working to redirect only logged out users
  46. Remove the deleted users avatar from list
  47. Debugging with functions.php
  48. Customizing login error messages
  49. Members only site – still need the lost password page accessible
  50. Get Current User info using wp_localize_script, in functions.php
  51. Load .txt file for login_message in wp-login.php
  52. How to add custom fields to my custom registration form
  53. create shortcode to list users with specific meta key value
  54. Don’t delete a page if it holds users
  55. How to make custom column Admin>Users sortable?
  56. How can I get my Script to work on the Login page?
  57. Execute a ultimate member action when user role is updated
  58. Removing wp_login_viewport_meta
  59. Filter out other users comments. Visualize only own comments and editor role users’ comments
  60. Force to use STRONG users password and implement rule to prevent REUSE [closed]
  61. Login Redirect if Logged in from Specific Page
  62. Unable to login using username
  63. Change label for registration Fields
  64. Warning: : DOMDocument::loadHTML(): Empty string supplied as input in functions.php when adding classes to post images
  65. Is possible to allow user to login with different role?
  66. Parse error after modifying the template menu [closed]
  67. When a user logs in, how can they view the website instead of the admin menu?
  68. WordPress PHP Conflicting User Sessions
  69. Get User Login Data (date, time… )
  70. WordPress error on log out ‘Not Permitted’ and can’t log out
  71. Registration Hooks don’t appear to be working
  72. help I changed one currency in woocommerce and everything is ruined [closed]
  73. Need help getting a function to function
  74. Connecting to a 2nd DB gives me no results when querying
  75. debugging errors.. how to remedy?
  76. Condition OR for current user ID
  77. If user is logged-in display/hide something
  78. Functions Error: Impacting Galleries
  79. How to Use Global Variables Inside Header and Footer
  80. Why get_user_by() doesn’t work in my code?
  81. Filter to wp_list_authors
  82. Prevent WordPress Automatic Logout
  83. Add Login/Logout Menu Item to Primary Nav “My Account” Submenu [Woocommerce] [closed]
  84. Logout Redirect and also WP-login.php Redirect
  85. How to add array [closed]
  86. Add Link to Users List (Backend) to open each users front-end profile
  87. Suggest Users basing on User taxonomy
  88. Showing user profile data on front-end
  89. Modify function to only return values for the user that’s logged in
  90. Strange error from functions.php files (wp_register_script)
  91. User meta and public function security
  92. call wp_insert_user in custom class doesnt work
  93. Get users with different roles and call function on each of them (user_meta)
  94. Add Login and logout buttons to top menu bar
  95. How can I show different content for different user-levels?
  96. Problems with functions.php! Error! [closed]
  97. Looking for Functions File that doesn’t Exist
  98. Custom user role still showing up after deletion, ideas?
  99. referencing the current user in a page i created in wordpress
  100. WordPress login set cookie that survive browser exit (wp_signon function)
Categories functions Tags errors, functions, login, users, wp-login-form
Creating and Using Tables in the WordPress Database
navigation among single posts

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