After developing some plugins for myself, some of them is ready to be published. For all, I’ve written deactivation functions, which deletes the set options, the database, etc. after themselves. But I’m having doubts about the reason for these, for example, what if it’s only a temporary inactivation?
What do you think, does a process need a cleanup hook for deactivation or not?
You shouldn’t cleanup the database on the
deactivation
hook. As @Darhazer said, use theuninstall
hook or create anuninstall.php
inside the plugin folder.What you can do is to create an export settings page, which the user can use to save/backup his data. You could call this page before deativation, so the user will be prompted with an option to save the data if you really want to cleanup the database on deactivation.
Use uninstall hook to delete all settings. On deactivation you can move temporary some data that was inserted in the plugin, like menu items, etc., but keep plugin settings active.