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?

2 Answers 2


You shouldn't cleanup the database on the deactivation hook. As @Darhazer said, use the uninstall hook or create an uninstall.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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.