Site icon Hip-Hop Website Design and Development

How to trigger function on theme delete?

Tried to find an or some hook to fire a function when theme is being delited, but didn’t find any hook..

May be someone can tell if there’s a way to fire my function on themes delete event?

I need it to delete options and drop tables on theme delete. ( for example )

Plugins do have uninstall.php or register_uninstall_hook().

Need same for themes! any help ?

My thoughts so far:

  1. create new WP_Filesystem_$module class and force WP to use my WP_Filesystem_$module class for deleting themes, where i can insert custom actions atc.

  2. insert custom action in deleted_site_transient action, checking if it was update_themes transient and check if theme was delited, wich theme was deleted etc..

Both methods has different questions like how to force my class or how to check wich theme was deleted in deleted_site_transient

What’s your thoughts on these ?