WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

When is it appropriate to remove a plugin's settings? On deactivation or uninstall?

share|improve this question
I prefer uninstall and use uninstall.php codex.wordpress.org/Function_Reference/… – Jesse Mar 11 '13 at 8:08
up vote 3 down vote accepted

Remove data only on uninstall. Deactivating plugins can be done by mistake or in order to troubleshot some other problem and you don't want to make the plugin users to config everything again in this situation.

Think about your PC software, does it delete its data when it is being closed and become inactive? no, only when it is uninstalled. Same applies here.

Actually the uninstall option is relatively new and it was created specifically to have a point where you know it is safe to delete data.

share|improve this answer

That depends on when the data is created.

If you register and set the options, create the tables etc. required by your plugin during install, you should not remove it on deactivation - or else you wouldn't be able to use the plugin after re-activation.

If you register and set the options/create the tables etc. during activation, you're fine to remove it on deactivation.

However, why would you want to do that? Do you write that much to the database that the site is running faster with your plugin's data removed?

share|improve this answer
In my case there are a number of options set, so I think it would be better for the user to be able to deactivate, and re activate at a later stage without having to re set all options. In this case therefore settings would be better removed on uninstall. – drtanz Mar 11 '13 at 10:42

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.