I need to replace the action of original wp-login login form:

Instead of

<form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post">

I need this form like this:

<form name="loginform" id="loginform" action="STATIC-CUSTOM-URL" method="post">

Is there any way to do this on functions.php?

  • 1
    what's the problem that this solves? Would a redirect not solve the problem? Keep in mind if a user is redirected to the official login page but is already logged in they'll be forwarded on the url parameter, and the form tag is skipped completely
    – Tom J Nowell
    Mar 29 at 19:41
  • I need to authenticate the user in another program before continuing to authenticate in wordpress. I dont need to replace all functions in wp-login, but only that form action. Mar 29 at 22:03
  • can you not load the relevant components or use the built in filters to redirect the user? There are lots of SSO implementations that either replace the login screen completely via a redirect so the user never sees it and sends them elsewhere ( this is how google/facebook/SAML plugins tend to work), or, use the filters to replace the login checks. Changing the login page form is a strategy I have never seen before
    – Tom J Nowell
    Mar 29 at 23:45
  • But if I replace the login page via a redirect, would it be possible to log out (wp-login.php?action=logout), remember password (/wp-login.php?action=lostpassword), and authenticate the user after authenticating him in the other program? I am not a developer, so sorry if it sounds like a silly question : ) Mar 30 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.