简体   繁体   中英

How do I supply the login to a wordpress site through a url?

I am linking to a protected Wordpress site through my website, and I would like to provide a link that automatically provides login credentials when clicked.

I'm running an apache serving with php5, although I have no php experience and was wondering if there is a simple way to provide login credentials through a url.

Thanks

Because of the way Wordpress users are authenticated, there is no way to do this with a simple URL. Take a peek at this related question: PHP, cURL post to login to WordPress

I would suggest you eliminate the need for the user to log in to Wordpress to complete the task you intend for them to do instead of this "hacky" method of forcing them in.

You could do this by writing a plugin on the target site. The plugin would hook in to the 'authenticate' action hook. In your implementation, you can use $_GET variables instead of the $_POSTed data. See this blog post for some code examples of doing this: http://www.johnkolbert.com/wordpress/how-to-add-your-own-authentication-criteria/

You'd have to redirect the user to the wp-login page on the target site and include a redirect= option as well to redirect the user once more to the desired page.

Note: it's usually considered dangerous to provide passwords in the URL. Apache logs the URLs and if someone compromises the server or tracks a user's URLs accessed then they'll have the passwords.

Literally there is no way to do that without login itself. I would suggest you to go through what kind of WordPress login URL'S are there in.

Also, it's not a recommended practice to include our login info into redirect URL'S for security purpose. Although you can try WordPress "Password Protected" Plugin to secure your password and then consider adding a redirect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM