How to send POST request to Wordpress website and do some actions

Viewed 626

I am new to WordPress, what I want to do is to send POST request in JSON format to WordPress website and basis of that request I want to send an email. what I want to know is... endpoint to send request? what functions or files will be use to handle post request

thanks.

1 Answers

One way is to do the following:

  1. Create a blank page and remember slug (here test-mypost) enter image description here

enter image description here

  1. Create and add code to custom .php (page-test-mypost.php) Have to be inside current theme (on same level as style.css ... root)

enter image description here

2.1. Add logic to page (test-mypost.php) (eg: if request type is post and param1 is something then send mails)

  1. Test page(yoursite/test-mypost)

enter image description here

Note: For how to write proper post request and send mail there are lot's of online docs very easy to find via a trivial search

Related