WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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.

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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