Title: Plugin Install and Uninstall Hooks
Last modified: August 19, 2016

---

# Plugin Install and Uninstall Hooks

 *  Resolved [ottobonn28](https://wordpress.org/support/users/ottobonn28/)
 * (@ottobonn28)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/plugin-install-and-uninstall-hooks/)
 * Hi,
 * I have been looking all over the web (including in the Codex) for the functions
   needed to install and uninstall a plugin. I know there is register_activation_hook
   and register_deactivation_hook, but what is I have a database table that needs
   to exist until the user totally deletes the plugin? I found two sites that talked
   about register_uninstall_hook, but this isn’t listed in the codex and so I don’t
   know if it is official. Is there any way to register a function to be called 
   only when the plugin is totally deleted?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [dagon-design](https://wordpress.org/support/users/dagon-design/)
 * (@dagon-design)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/plugin-install-and-uninstall-hooks/#post-1160822)
 * This page gives some info, but I have not tried it myself:
 * [http://wpengineer.com/wordpress-plugin-deinstall-data-automatically/](http://wpengineer.com/wordpress-plugin-deinstall-data-automatically/)
 *  Thread Starter [ottobonn28](https://wordpress.org/support/users/ottobonn28/)
 * (@ottobonn28)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/plugin-install-and-uninstall-hooks/#post-1160836)
 * Is it better to delete all of the plugin’s data every time it’s deactivated? 
   That seems to be what the Codex suggests. It seems like that would be extremely
   frustrating to the user.
 *  [dagon-design](https://wordpress.org/support/users/dagon-design/)
 * (@dagon-design)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/plugin-install-and-uninstall-hooks/#post-1160857)
 * I personally do not write my plugins to delete the data, simply because I think
   it is easier to have it remember the last settings. But then again, most of my
   plugins simply keep options in the database.
 * If you have a plugin that is creating entirely new tables, or massive amounts
   of data in the DB, it might be more useful to delete them if the plugin is no
   longer needed.
 *  Thread Starter [ottobonn28](https://wordpress.org/support/users/ottobonn28/)
 * (@ottobonn28)
 * [16 years, 9 months ago](https://wordpress.org/support/topic/plugin-install-and-uninstall-hooks/#post-1160946)
 * Well I suppose it’s more a matter of personal preference then. Thanks for the
   link.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Plugin Install and Uninstall Hooks’ is closed to new replies.

## Tags

 * [development](https://wordpress.org/support/topic-tag/development/)

 * 4 replies
 * 2 participants
 * Last reply from: [ottobonn28](https://wordpress.org/support/users/ottobonn28/)
 * Last activity: [16 years, 9 months ago](https://wordpress.org/support/topic/plugin-install-and-uninstall-hooks/#post-1160946)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
