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

WordPress custom login page

You have in many ways already answered your question: the technique described in the article is not going to be reliable. What you might not have worked out is “why”.

The code uses relative URLS…

<form name="loginform" id="loginform" action="/wp-login.php" method="post">

… which are nearly always unreliable in WordPress context. That won’t work if the site is installed in a directory so that the login url is at www.example.com/directory/wp-login.php.

Second, the code uses wp-login.php as the form action (not site_url('wp-login.php'), please note, or even wp_login_url() which would be correct), meaning that when you submit the form you go to the old login page for processing. If something goes wrong, that page is where you end up.

Third, the site_url regex hack will only work if you use site_url or functions that use site_url. It won’t work if a plugin or theme does not use those functions, nor will it work if someone ( as I usually do ) just types wp-login.php into the address bar.

Fourth, regexing site_url is not the way to go. You are running regex every time that function is used. How many times is that going to used for a login link? Less than 1%? Very wasteful.

A better hook would be login_url, which is made for this circumstance.

Basically, this is a very superficial login page hack, not a “WordPress Login page complete redesign”. There are better ways to customize your login page, the most straightforward being to use the actions and filters on the login page itself. If you choose to use a completely different page that wp-login.php you will need to duplicate most of the default functionality as that page has both functions and raw HTML and isn’t easily included in other pages without making a mess.

Related Posts:

  1. Custom ReCaptcha Login
  2. How to override wp-login.php
  3. Custom Login and Registration form in Ajax
  4. Auto redirect after session expire, but only for one user
  5. Properly customizing login/register form
  6. Deep customization of wp-login.php
  7. A truely custom login page?
  8. Change the default WordPress image on the dashboard login to a custom image [duplicate]
  9. how to manage Session in WordPress using custom login?
  10. Change the login button on the login page
  11. What is the proper way to apply the login_form_bottom filter?
  12. Remove Links from Login page
  13. Change “You are now logged out” text
  14. setting a specific home page for logged in users
  15. Change “logged in” link in (you must be logged in to post a comment)
  16. Redirect to requested page after (custom) login
  17. Customizing the default logout page of WordPress
  18. How do I remove the eye icon that shows visibility on login screen and reset password screen
  19. Last time a user logged in
  20. How can I allow access to multiple users, using the same login, at the same time?
  21. Adding a login form that concatenates three fields into a username
  22. How to add an extra variable to login and authenticate it?
  23. Add Custom API Call to WP-Login.php
  24. Login/Logout Session Sharing – Multiple WordPress Installations
  25. Auto login from custom registration form
  26. Custom login with external provider iframe and data object
  27. User can not login
  28. Lost password empty field error redirect to custom login
  29. WordPress error on log out ‘Not Permitted’ and can’t log out
  30. Custom Log In Screen – Disable password recovery [duplicate]
  31. Multi-site User Sessions
  32. Custom Login Process
  33. Switch between WordPress websites easy for an end user
  34. Lost password and back to blog in same line
  35. I w’d like to know If there are simple solutions to integrate other CMSs to wordpress
  36. Restrict content access to logged in users
  37. Custom login and registration forms
  38. How to create a custom WordPress front page
  39. URL and Site title outputting on Login page
  40. Is it possible to integrate a custom login feature with wordpress?
  41. Open login logo URL in new tab
  42. How to change the login page without a plugin and not only customizing logo and text around the form?
  43. Removing “Failed” query argument upon successful login
  44. Validate user login in php
  45. Removing “There is no account with that username or email address.” error message in “/wp-login.php?action=lostpassword”
  46. No plugin populate user information in to form
  47. how to change the url rediction of the woocommerce login page of the flatsome theme for my own in wordpress?
  48. How to change Login default blue admin color?
  49. Latest update broke my custom login CSS
  50. Trouble with custom login page
  51. Wrap WordPress Login Form in custom Div
  52. Custom password set/reset link in same URL format as default does’t work
  53. Custom login doesn’t stay
  54. Check get_post value after wp-admin login
  55. where can i find the login page in wordpress and add my header to it
  56. Pass the post ID
  57. Show Site Name on WP login screen
  58. Use wp_login_form function to login with a custom user table?
  59. Redirect all pages to the custom login page except for the registration page
  60. How to stop login for SPECIFIC users BEFORE a specified date
  61. wp_login_form display no styled form
  62. Must I rewrite the whole login form or can I jsut do a part
  63. Looking for a way to align log in form fields with background image and scale responsively
  64. How to compare number with id of post in certain category
  65. Url rewriting on custom post with CPT UI plugin
  66. Custom dropdown search form that allows users to select option B based from Option 1
  67. Translate site in own text-language [closed]
  68. Custom stylesheet not loading
  69. User WordPress menu in custom page
  70. Smarter Document Management links between three WordPress sites sought
  71. Custom Single Template
  72. how to auto fille conatct form 7 when user is logined
  73. Custom Admin Section
  74. data retrieval presents last set of data
  75. Local and live synchronized dev and production environment [closed]
  76. How to define active widget with js in a customizer
  77. If a theme will undergo major changes would it be better to clone the parent instead of writting a child theme?
  78. How to add custom Author Info Box to blog posts “only” and NOT custom post templates
  79. Upload image without resizing but insert in post with resizing
  80. Bio comes up when the visitor clicks on a picture
  81. Adding images to anchors in the list created and fetched with wp_nav_menu
  82. Unable to write error_log output… but only from a certain function
  83. Displaying Child Page’s Information
  84. Expressions and str_replace
  85. How to create a new blog in wordpress?
  86. How to find and replace (or add) specific word in a specific category?
  87. In wordpress customizer api adding div wrap to control
  88. How to create 2 preview button in a post?
  89. Multiple Owl Carousels on the same page with navigation problem
  90. Create single{custom}.php with data in table out of wp_posts
  91. permalink of word press in htacess
  92. Show comments based on user role in front end
  93. How to implement custom Javascript to my site
  94. generate a static copy of the website footer html
  95. Multi-site customization
  96. Move text from the side of image to below image [closed]
  97. WordPress Inline Style missing
  98. How do i edit text that is not in the customization menu
  99. How do I enable the text editer in my WordPress theme? [closed]
  100. how to refresh page after user logout with ‘wp_logout_url’?
Categories customization Tags customization, login, logout, wp-login-form
Update Custom post field by Ajax on cached site
Combine multiple custom field values into single value

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