I have a plugin that creates tables when activated or when a new blog is added to a network. When a blog is deleted I would like to be able to remove those tables for that blog. Is there a hook available to do this?
I imagine it would be something similar to wpmu_new_blog, but I can’t find an equivalent for deleting.
The function
wpmu_delete_blog
in/wp-admin/includes/ms.php
has an action hook calleddelete_blog
. This hook passes the variable of$blog_id
You could try plugging into that hook, although it is executed right at the beginning of the function.
This is arguably the better way to do it if you’re just deleting tables, but nothingtosee’s answer is also valid, and would be the required way if you need to do something besides dropping tables.