Submit Post with Media Attachment using WP-REST API

WP-REST API has improved considerably since its first iteration. Recently, we were supposed to create a form which would enable users to create a post with featured media attachment. In this case, we would have to first call the API to upload the media and then make a second call to add the image as a featured image to the inserted post.

For the basic form submission using WP-REST API, I think Josh Pollock on Appressor did an excellent job demonstrating that. In this tutorial, we will be extending the form to insert posts with file submissions using WP-REST API.