Is it appropriate to remove custom posts and terms on plugin uninstall?

This is more of a “best practices” than a question, but I was wondering, what to people typically remove when their plugin is removed? I have a plugin that does the following:

  • registers custom post types
  • registers custom taxonomies
  • uses custom options

Right now my plugin removes all of the custom options as they are installed by the plugin and used mostly internally. Since the posts for the custom post type and terms for the custom taxonomy are added by the user, would be be appropriate to remove these?

2 Answers
2

In another answer I wrote about uninstall/activate/deactivate/upgrade routines. I guess most of the comments already tell it, but to sum it up:

  • Uninstall: Remove everything, your plugin added
  • Deactivate: Do nothing
  • Activate: Do what your plugin needs.

On Uninstall the user simply wants to get rid of the plugin, so it’s fair to not leave any mess. Remove everything including tables, etc. Ok, if you got tables, you should maybe tell the user what your plugin is going to do. A simple alert() should do the trick.

Leave a Comment