12% off of LTD using this coupon: TWELVEPERCENTOFF. Promo ends on 2 Dec midnight UTC.
Published on Mar 17, 2022

Enable Logged-in Users to Delete Their Posts on the Frontend Using WordPress REST API

Sridhar Katakam

This members-only tutorial provides the steps to add "Delete" links next to a list of posts on a custom user dashboard which when clicked deletes the corresponding post (gets moved to the Trash).

We shall

  • create a Dashboard Page per this tutorial
  • modify the WP_Query instance's loop to add Delete links for each post
  • load a js file on the Page which
    • gets all the delete links
    • loops through them and adds a click event listener that sends a DELETE request to WordPress REST API for the corresponding post and then remove the parent list item of the clicked Delete link using cookie authentication

Step 1

Implement the Frontend editing with ACF in Oxygen tutorial.

Step 2

Replace the PHP in the Code Block with:

This is a premium members-only content.

To view the rest of the content, please sign up for membership ($47/month or $599 one-time).

Already a member? Log in below or here.