Created and finalized the function delete (inactivate) a post