I'm manually creating my own Wordpress login form. The action parameter of all the forms points to wp-login.php. I want to change it for all of them to custom url (/login). Any idea how to that?

For example:

<form name="lostpasswordform" id="lostpasswordform"
action="http://mywebsite.com/wp-login.php?action=lostpassword" method="post">

So I want to change the form action into mywebsite.com/login/?action=lostpassword Note, I need for both Login, Register and Lost Password.

Kind regards.

  • I think you could to this with an Url rewrite rule, either in htaccess or using WP's rewrite API.
    – Hans
    Sep 26 '18 at 11:48
  • @Michael neither way, it's out of question. in WP, you almost never need to (and shoulnd't) touch htaccess, unless no other way remains there.
    – T.Todua
    Sep 26 '18 at 13:46

Follow standards instead of ugly solutions. Use WP filter (put inside functions.php):

add_filter( 'site_url', 'my_url_modifier', 10, 4 );

function my_url_modifier( $url, $path, $scheme, $blog_id)
        return 'http://your_link..';
        return $url;

p.s. You should add other links there link example. Also, you can sanitise further parameters, like : if ($path=='wp-login.php')....

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.