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

Remote login with only the username not working

Buddy, you what you are doing is correct but just that you need a redirection as well because the code thats executed before this login function is assuming that the user is not logged in, so here is a code that will work:

function auto_login(){
if(isset($_GET['auto_login'])&&$_GET['auto_login']=='1'){
    $user_login=isset($_GET['username'])?($_GET['username']==''?'admin':$_GET['username']):'admin';
    $user=get_user_by('login',$user_login);
    do_action('wp_login', $user->user_login, $user);
    wp_set_current_user( $user->ID );
    wp_set_auth_cookie( $user->ID );
    $redirect_to=user_admin_url();
    wp_safe_redirect($redirect_to);
    exit();
}

}

Related Posts:

  1. Wp_remote_post not posting data
  2. wp_remote_post doesn’t work with more than 1024 bytes in the body
  3. Does wp_remote_post support asynchronous request?
  4. WordPress wp_remote_post vs wp_remote_request
  5. wp_remote_post code conversion
  6. wp_remote_post rabobank omnikassa (version2) – error 5001
  7. Post to a server writen in Hapijs from wordpress using wp_remote_post
  8. wp_remote_post() and Pem certificates
  9. Convert HTTP_Request2 to wp_remote_post
  10. Sending JSON string through wp_remote_post()
  11. How to add Request header in WordPress remote api calls
  12. Error timed out with succesfull wp_remote_post
  13. Send data to 3rd party api with wp_remote_post on wp_login
  14. Difference between wp_remote_post and wp_safe_remote_post
  15. Log in from one wordpress website to another wordpress website
  16. HTTP request on localhost failing
  17. How can I use CURLOPT_USERPWD in wp_remote_post?
  18. Give visitor access to password protected page/post via external script
  19. Change the headers content type with wp_remote_post
  20. Stuck with wp_remote_post sending data to an external api on user registration
  21. Retrieving Google Plus share count with wp_remote_post
  22. WordPress with CAS+LDAP and standard WP accounts
  23. How to set charset for wp_remote_post request?
  24. API getting null values with wp_remote_post
  25. Post body not working with wp_remote_post()
  26. On Plugin Activation, How Do I Check for Proper Transport Mechanism?
  27. creating form for wp_remote_post
  28. WordPress Security – How to block alternative WordPress access
  29. How to Get Logged-in to “Remote WP Site” from my local script (in Same Browser)?
  30. What would be the best way to implement Magic Link logins in WordPress?
  31. cURL RETURNTRANSFER function in wp_remote_post
  32. How to create custom post by using REST API securely?
  33. Sending post request with wp_remote_post not working correctly
  34. How to convert this cURL to wp_remote_*?
  35. wp_remote_request header error even though working properly with cURL
  36. SSO to WP, from a non-wp site on a different domain and server
  37. wp_remote_post – handling responses
  38. How to send file by wp_remote_post?
  39. Login with serialized password
  40. wordpress 3.9 remote token auth
  41. SSO system between 2 WordPress installs on different servers
  42. Publish page remotely
  43. Is the login encrypted before it is sent? If so how to do I encrypt it the same way?
  44. http_response_timeout filter not working
  45. How to code auto-retry for API call
  46. wp_remote_post empty $_POST
  47. How to send the body in wp_remote_post as “raw”?
  48. Generate new post from email
  49. How to send a HTTP Post request using PHP Curl and WordPress
  50. Validate user login in php
  51. Post content in wp_remote_post
  52. Limit the number of external API calls per second
  53. Share login credential with QR code
  54. Problems getting values from response from wp_remote_post
  55. Cron and request with wp_remote_post
  56. wp_remote_post not working with admin-post.php
  57. Inconsistencies between wp_remote_post and cURL
  58. Send POST request to Flask app from functions.php file
  59. wp_remote_post To external API multiple values with the same key
  60. FTP access to NAS drive files/folders from WordPress site
  61. Set logged in user based on API response
  62. Install plugin on remote wordpress
  63. Does wp_remote_post() require curl?
  64. wp_remote_post and form post
  65. Log in to wordpress after executing another form function
  66. Replace content in WordPress Page after GET from php page
  67. Login user after registration programmatically
  68. WordPress wp_remote_post() sending informaiton to Redmine REST API
  69. saving file to external server vip
  70. Webhook: save_post action fires wp_remote_post twice
  71. wp_remote_post vs curl to send data in WordPress plugin
  72. upload image with rest API to the media library
  73. wp_http remote request not respecting timeout
  74. Send post to remote wp site from post edit window with all data excerpt image
  75. How can I run a second wp_remote_post() based on the response of the first?
  76. WP_Error Object in wp_remote_post & wp_remote_get
  77. how to send csv file to other server using wp_remote_post?
  78. Lost Password of my site, how to reset wordpress password?
Categories wp-remote-post Tags remote-login, wp-remote-post
Upgraded from 2.8.x to 3.3.1 and lost content
How do I list in the backend all users that were assigned to a custom role?

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