Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
2  
just add an option that allows the user to choose to remove that data if they wish –  onetrickpony Jan 8 '12 at 17:32

2 Answers 2

I think it's important that you remove custom options by default (or maybe even give the user the chance to export/import them, depending on the depth/scope of your plug-in).

The user should definitely be prompted before deleting custom posts and taxonomies though (i.e. "Would you also like to delete..."). Maybe they wish to re-use the data with their own functions, another plug-in or otherwise.

share|improve this answer

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.

share|improve this answer
    
I agree that on uninstall the plugin should removed everything it added, but did the plugin add the posts or did the user add the posts? I think the best solution is to give the user the option to decide, but I'm still interested in what you think. –  v0idless Jan 9 '12 at 2:22
    
On this point I'm with @OneTrickPony . If it's really posts, then you should ask the user anyway. If it's CPT contents, then it depends on what actually the CPT does. If it's something, that can be re-used by some other plugin: Ask. If not: Delete. Imagine some user has to delete hundreds of posts per hand. That would be an extreme pain. –  kaiser Jan 9 '12 at 2:41

Your Answer

 
discard

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.