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

Handle POST request sent from an external site for login?

1. Do I need to define a new URL for handling the $_POST request?

No, you don’t need to define new URL.

2. Which action hook do I need to use for handling such a request?

You can use init hook.

Sample code

function my_theme_send_email() {

    if ( isset( $_POST['email-submission'] ) && '1' == $_POST['email-submission'] ) {

        // Send the email...

    } // end if

} // end my_theme_send_email
add_action( 'init', 'my_theme_send_email' );

Now you can call your website with POST required POST parameters.

Update:

Executed function on init method

Executed function on init method

my code

my code

Related Posts:

  1. Can I programmatically login a user without a password?
  2. SSO / authentication integration with external ‘directory service’
  3. What is $interim_login?
  4. Adding extra authentication field in login page
  5. What exactly is ReAuth?
  6. Login members using web services
  7. Disable WordPress 3.6 idle logout / login modal window / session expiration
  8. How to pass users back and forth using session data?
  9. Need to execute a cron job
  10. How to keep always logged in development environment
  11. how to update current logged user username
  12. Validate Custom Login field
  13. Calling wp_signon doesn’t log the user in
  14. How to implement Google reCaptcha without installing a plugin?
  15. Is it possible a one click user registration with Facebook or Twitter (or other Social Networks)?
  16. Are there ways of logging in that bypass wp-login.php altogether?
  17. How to display username and password after registration
  18. Completely replacing the login form
  19. Two factor authentication
  20. Single sign on with custom site
  21. Removing wordpress cookie from non-wordpress site
  22. How to generate “WP_Error” Object for user login?
  23. Allow Access to Home Page and Login Screen but Nothing Else (unless logged in)
  24. Where is the php file, that does the checks for login information?
  25. I want login using email not username wordpress front end
  26. Reloading page with a query string upon login for admins
  27. WordPress authentication using custom php?
  28. Single sign on for multiple domains
  29. authenticate user without redirecting
  30. Multiple issues with Ajax login function due to browsers and cookies
  31. How to post frontend login form to a different authentication script from wp-login?
  32. Custom user roles are unable to login
  33. Using WordPress login for a non word-press website
  34. Extend Cookie with auth_cookie_expiration not working
  35. Can we start session from another php site to wordpress blog site?
  36. Opening protected page with cookie?
  37. External Authentication
  38. Login and register by API
  39. In Django, how do I know the currently logged-in user?
  40. Can’t log in: “ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.”
  41. Is there any way to rename or hide wp-login.php?
  42. How to login with email only no username?
  43. How can I redirect user after entering wrong password?
  44. Increase of failed login attempts, brute force attacks? [closed]
  45. Login page ERROR: Cookies are blocked due to unexpected output
  46. Separate registration and login for different roles
  47. Preventing session timeout
  48. Create API for single sign-on with 3rd party site
  49. How reduce wordpress login session timeout time?
  50. How to prefill WordPress registration with social details
  51. Check for correct username on custom login form
  52. How to Change the Default Home Page for the WordPress Dashboard?
  53. Disallow user from editing their own profile information
  54. I can’t access my site via wp-admin
  55. ‘Password field is empty’ error when using autofill in Chrome
  56. Removing username from the ‘wordpress_logged_in’ cookie
  57. How to show ‘login error’ and ‘lost password’ on my template page?
  58. How do I require authorization / login to view a specific set of posts / pages?
  59. Custom login form
  60. How to prefill the username/password fields on the login page
  61. wp_signon returns user, but the user is not logged in
  62. JWT authentication with WP – Approach
  63. Prevent wp_login_form() from redirecting to wp-admin when there are errors
  64. Redirect user using the ‘wp_login_failed’ action hook if the error is ’empty_username’ or ’empty_password’
  65. wp_signon() does not authenticate user guidance needed
  66. What are the differences between wp_users and wp_usermeta tables?
  67. WordPress auto login after registration not working
  68. Make my wordpress blog remember my login “forever”
  69. How to check in timber if user is loggedin?
  70. How do I change the language of only the login page?
  71. Stop WordPress from logging me out (need to keep me logged in)
  72. Woocommerce registration page [closed]
  73. How to disable autocomplete on the wp-login.php page
  74. Share login data/cookies between multiple installations
  75. Synchronize WordPress user accounts across multiple domains and installations without using WordPress MU
  76. How do I change the logo on the login page?
  77. Why does WordPress hide the reset password key from the URL?
  78. Is it possible to sign in with user_email in WordPress?
  79. How to use current_user_can()?
  80. Avoid to load default WP styles in login screen
  81. WordPress registration message
  82. How to fake a WordPress login?
  83. how to display the wordpress login and register forms on a page?
  84. Does wp_logout_url() destroy a session? (Logging out question)
  85. How can I send a welcome email to a user AFTER they login for the first time?
  86. Can not login with correct username and password
  87. Website Visible only to Registered users
  88. How can i increase the login expiration length?
  89. How do I use add_action from a class method?
  90. How to remove the WordPress logo from login and register page?
  91. How can I add a custom script to footer of login page?
  92. Brute force attack?
  93. Customize wp_new_user_notification_email()
  94. How to check WordPress website username and password is correct
  95. Login email after registration never sent or received
  96. How can I create a separate blog that is private?
  97. Add Confirm Password field in wp-login.php Password Reset page
  98. Integrate recaptcha and wp_signon – what is needed?
  99. Log in from one wordpress website to another wordpress website
  100. Stop users from logging in from multiple locations
Categories login Tags authentication, login, single-sign-on
Custom Post Type archive above Single Post in single.php (same author)
Cannot save values to custom fields for variations on Woocommerce 2.4.6

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