Error after deleting Custom Post Type with a function (no trash used)

I’m using a function which I built to delete all posts from a user after a specific post is deleted. In my case I’m using a Custom Post Type called company. And additional Custom Post Types like jobs or events. If the company profile gets deleted, all other posts from this user are also deleted. … Read more