POST Request to REST API

Learn to send a POST request to create a lecture post in the database.

We have added functionality to edit and delete lecture posts that are added from the admin dashboard. Now we will set up the code to add a new note from the frontend. To add a note, we will provide a form with title and content input elements. The users will click the Create button which will add the post to the database as well as show it on the frontend on the fly.

Create a form

Open the page-lecture-notes.php file. We will create a form above the list of posts, but inside the <div> with class generic-content. The form is placed in a <div> with class add-lecture. It has an input and textarea element as well as a <span> for the Create button.

Get hands-on with 1400+ tech skills courses.