Im using swish-e to index my corporate site and documents. Problem is that i need to login to wordpress via get variables.
Wordpress login uses post variable but i need to login with GET variables
There is any easy way to do it? I dont mind changing core files, is there is no other option.
I took a look at wp-login.php but i dont have a clue on how to do this.
Regards
Using GET variables for usernames and passwords is never a good idea. But anyway, something like the following should work
You can put this in a template and then create a page using that template to create an alternative log-in page. In that case, you’ll want to go to : http://[url of page]?log=username&pwd=password
To get http://mysite.com/wp-login.php?log=username&pwd=password, you will have to put the above code in the wp-login.php core file. Rather than adapting the code (which will be overwritten when you next update WordPress), I recommend using a hook. Like, so (put this in your
functions.php
or a plug-in):Explanation:
Our function is run using
init
hook. It first checks that we are on the./wp-login.php
page, and then that thelog
andpwd
variables are set. If not, we carry on as normal. If they are, we attempt a log-in, usingwp_signon
. If we are successful, we are redirected (wherever you like), otherwise if it fails, we do something (display errors, maybe?).Hope that helps