Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
The node_delete() function requires to have the delete permission for the current logged user.
If you run the node_delete() function as anon user, is probably that doesn't work