Generally I don’t need or wish to delete posts I’ve publish however on occasions it’s necessary: because either the content has failed to syndicate to other sources properly or I wish to revoke an opinion or comment made in haste.
In such cases I’d previously returned a 404 Not Found response for deleted posts. This not only went against recommended implementation but, now that I regularly Send Webmentions; it’s all the more important should I later decide to revoke a reply/RSVP or like that I return a clear, valid response on the page receiving the webmention.
Updating not deleting
In the PHP class I used for adding, updating and removing posts I amended the existing delete function so that rather than clearing the entry completely; it just updates the post type to “removed”. This not only keeps the permalink in place but should I later want to reinstate the post then all the contents is still within the database.
Sending a second Webmention
Furthermore if the post type is a webmention then the target URL stored within the post is pinged again to tell it that the reply, RSVP or like has now been removed.
On the front-end I use a conditional statement above the template’s content for rendering posts to check if it’s been categorised as removed.
Posts that have the “removed” type include the new header with the more appropriate response code 410 (Gone). Following this is a custom template included to override the browser’s generic 410 response page.